Java Code Examples for org.apache.commons.lang3.StringUtils#indexOf()

The following examples show how to use org.apache.commons.lang3.StringUtils#indexOf() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: nifi-registry   File: CertificateUtils.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Extracts the username from the specified DN. If the username cannot be extracted because the CN is in an unrecognized format, the entire CN is returned. If the CN cannot be extracted because
 * the DN is in an unrecognized format, the entire DN is returned.
 *
 * @param dn the dn to extract the username from
 * @return the exatracted username
 */
public static String extractUsername(String dn) {
    String username = dn;

    // ensure the dn is specified
    if (StringUtils.isNotBlank(dn)) {
        // determine the separate
        final String separator = StringUtils.indexOfIgnoreCase(dn, "/cn=") > 0 ? "/" : ",";

        // attempt to locate the cd
        final String cnPattern = "cn=";
        final int cnIndex = StringUtils.indexOfIgnoreCase(dn, cnPattern);
        if (cnIndex >= 0) {
            int separatorIndex = StringUtils.indexOf(dn, separator, cnIndex);
            if (separatorIndex > 0) {
                username = StringUtils.substring(dn, cnIndex + cnPattern.length(), separatorIndex);
            } else {
                username = StringUtils.substring(dn, cnIndex + cnPattern.length());
            }
        }
    }

    return username;
}
 
Example 2
Source Project: sailfish-core   File: PagedFileViewer.java    License: Apache License 2.0 6 votes vote down vote up
private int createLines(CharBuffer buffer, StringBuilder out, int lines) {
    int fakeSeparators = 0;
    if (lines > 0 && buffer.remaining() > 0) {
        int index = StringUtils.indexOf(buffer, SEPARATOR);
        if (index < 0 || index > width) {
            index = buffer.remaining() < width ? buffer.remaining() : width;
            out.append(buffer.subSequence(0, index));
            out.append(SEPARATOR);
            fakeSeparators++;
            buffer.position(buffer.position() + index);
            lineCounter++;
        } else {
            out.append(buffer.subSequence(0, index + SEPARATOR_LENGTH));
            buffer.position(buffer.position() + index + SEPARATOR_LENGTH);
            lineCounter++;
        }
        fakeSeparators += createLines(buffer, out, lines - 1);
    }
    return fakeSeparators;
}
 
Example 3
Source Project: logbook   File: BattleAggDialog.java    License: MIT License 6 votes vote down vote up
public BattleResult(String line) {
    try {
        String[] cols = line.split(",", -1);
        // 日付書式
        SimpleDateFormat format = new SimpleDateFormat(AppConstants.DATE_FORMAT);
        // 日付
        this.date = DateUtils.toCalendar(format.parse(cols[0]));
        this.date.setTimeZone(AppConstants.TIME_ZONE_MISSION);
        this.date.setFirstDayOfWeek(Calendar.MONDAY);
        // 海域
        this.area = cols[1];
        // ランク
        this.rank = cols[4];
        // 出撃
        this.isStart = StringUtils.indexOf(cols[3], "出撃") > -1;
        // ボス
        this.isBoss = StringUtils.indexOf(cols[3], "ボス") > -1;
    } catch (ParseException e) {
    }
}
 
Example 4
private FqTopic DTO2DO(V2exDTO v2exDTO) {
    if(v2exDTO == null){
        return null;
    }
    FqTopic fqTopic = new FqTopic();
    fqTopic.setAuthor(v2exDTO.getAuthor());
    fqTopic.setAuthorIcon(v2exDTO.getAuthorIcon());
    if(StringUtils.isEmpty(v2exDTO.getContent())){
        if(CollectionUtils.isEmpty(v2exDTO.getTopicContent())){
            v2exDTO.setContent(v2exDTO.getTitle());
        }else {
            StringJoiner ss = new StringJoiner(",");
            for(String t : v2exDTO.getTopicContent()){
                ss.add(t);
            }
            v2exDTO.setContent(ss.toString());
        }
    }
    fqTopic.setContent(v2exDTO.getContent() == null?"":v2exDTO.getContent());
    fqTopic.setGmtCreate(new Date());
    fqTopic.setSource(SpiderSourceEnum.V2EX.getValue());
    fqTopic.setType(v2exDTO.getType());
    fqTopic.setTitle(v2exDTO.getTitle()== null?"":v2exDTO.getTitle());
    if(fqTopic.getTitle().length() > 100){
        fqTopic.setTitle(fqTopic.getTitle().substring(0,98));
    }
    String comment = v2exDTO.getComment();
    comment = comment == null?"":comment;
    int index = StringUtils.indexOf(comment,"回复");
    if(index != -1){
        comment = StringUtils.substring(comment,0,index);
        comment = comment.trim();
        fqTopic.setCommentCount(Integer.valueOf(comment));
    }else {
        fqTopic.setCommentCount(0);
    }

    return fqTopic;
}
 
Example 5
Source Project: saluki   File: ConsulRegistry.java    License: Apache License 2.0 5 votes vote down vote up
private GrpcURL buildURL(ConsulService service) {
  try {
    for (String tag : service.getTags()) {
      if (StringUtils.indexOf(tag, Constants.PROVIDERS_CATEGORY) != -1) {
        String toUrlPath = StringUtils.substringAfter(tag, Constants.PROVIDERS_CATEGORY);
        GrpcURL salukiUrl = GrpcURL.valueOf(GrpcURL.decode(toUrlPath));
        return salukiUrl;
      }
    }
  } catch (Exception e) {
    log.error("convert consul service to url fail! service:" + service, e);
  }
  return null;
}
 
Example 6
/**
 * 
 * @param langDefinition
 * @return the language code (truncate language definition when option is
 * defined)
 */
protected String extractEffectiveLang(String langDefinition) {
    int separatorIndex = StringUtils.indexOf(langDefinition, '-');
    if (separatorIndex != -1) {
        return StringUtils.substring(langDefinition,0,separatorIndex);
    }
    return langDefinition;
}
 
Example 7
Source Project: vjtools   File: FilePathUtil.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 在Windows环境里,兼容Windows上的路径分割符,将 '/' 转回 '\'
 */
public static String normalizePath(String path) {
	if (Platforms.FILE_PATH_SEPARATOR_CHAR == Platforms.WINDOWS_FILE_PATH_SEPARATOR_CHAR
			&& StringUtils.indexOf(path, Platforms.LINUX_FILE_PATH_SEPARATOR_CHAR) != -1) {
		return StringUtils.replaceChars(path, Platforms.LINUX_FILE_PATH_SEPARATOR_CHAR,
				Platforms.WINDOWS_FILE_PATH_SEPARATOR_CHAR);
	}
	return path;

}
 
Example 8
public void encodeBegin(FacesContext facesContext, UIComponent component) throws IOException {
	// If this is a currently sorted sort header, always give it the
	// "currentSort" CSS style class
	try{
		if(component instanceof HtmlCommandSortHeader){
			HtmlCommandSortHeader sortHeader = (HtmlCommandSortHeader) component;
			String styleClass = StringUtils.trimToNull(getStyleClass(facesContext, component));
			String newStyleClass;
			String unStyleClass;
			if(sortHeader.findParentDataTable().getSortColumn().equals(sortHeader.getColumnName())){
				newStyleClass = CURRENT_SORT_STYLE;
				unStyleClass = NOT_CURRENT_SORT_STYLE;
			}else{
				newStyleClass = NOT_CURRENT_SORT_STYLE;
				unStyleClass = CURRENT_SORT_STYLE;
			}
			if(StringUtils.indexOf(styleClass, newStyleClass) == -1){
				if(StringUtils.indexOf(styleClass, unStyleClass) != -1){
					styleClass = StringUtils.replace(styleClass, unStyleClass, newStyleClass);
				}else if(styleClass != null){
					styleClass = (new StringBuilder(styleClass)).append(' ').append(newStyleClass).toString();
				}else{
					styleClass = newStyleClass;
				}
				sortHeader.setStyleClass(styleClass);
			}
		}
	}catch(Exception e){
		log.warn("Exception occurred in HtmlSortHeaderRenderer:" + e.getMessage());
	}
	super.encodeBegin(facesContext, component); // check for NP
}
 
Example 9
public void encodeBegin(FacesContext facesContext, UIComponent component) throws IOException {
	// If this is a currently sorted sort header, always give it the
	// "currentSort" CSS style class
	try{
		if(component instanceof HtmlCommandSortHeader){
			HtmlCommandSortHeader sortHeader = (HtmlCommandSortHeader) component;
			String styleClass = StringUtils.trimToNull(getStyleClass(facesContext, component));
			String newStyleClass;
			String unStyleClass;
			if(sortHeader.findParentDataTable().getSortColumn().equals(sortHeader.getColumnName())){
				newStyleClass = CURRENT_SORT_STYLE;
				unStyleClass = NOT_CURRENT_SORT_STYLE;
			}else{
				newStyleClass = NOT_CURRENT_SORT_STYLE;
				unStyleClass = CURRENT_SORT_STYLE;
			}
			if(StringUtils.indexOf(styleClass, newStyleClass) == -1){
				if(StringUtils.indexOf(styleClass, unStyleClass) != -1){
					styleClass = StringUtils.replace(styleClass, unStyleClass, newStyleClass);
				}else if(styleClass != null){
					styleClass = (new StringBuilder(styleClass)).append(' ').append(newStyleClass).toString();
				}else{
					styleClass = newStyleClass;
				}
				sortHeader.setStyleClass(styleClass);
			}
		}
	}catch(Exception e){
		log.warn("Exception occurred in HtmlSortHeaderRenderer:" + e.getMessage());
	}
	super.encodeBegin(facesContext, component); // check for NP
}
 
Example 10
Pair<ParamMatchTypeEnum, Integer> findInboundParamMatch(final String responseBody) {

        if (responseBody == null) {
            return null;
        }

        for (ParamMatchTypeEnum p : ParamMatchTypeEnum.values()) {
            final int pos = StringUtils.indexOf(responseBody, ParamMatchTypeEnum.PARAM_PREFIX + p.name() + ((p.takesArg()) ? "(" : ""));
            if (pos > -1) {
                return Pair.of(p, pos + ((p.takesArg()) ? 1 : 0));
            }
        }

        return null;
    }
 
Example 11
Source Project: vjtools   File: CsvUtil.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Parse fields as csv string,
 */
public static String toCsvString(Object... elements) {
	StringBuilder line = new StringBuilder();
	int last = elements.length - 1;
	for (int i = 0; i < elements.length; i++) {
		if (elements[i] == null) {
			if (i != last) {
				line.append(FIELD_SEPARATOR);
			}
			continue;
		}
		String field = elements[i].toString();

		// check for special cases
		int ndx = field.indexOf(FIELD_SEPARATOR);
		if (ndx == -1) {
			ndx = field.indexOf(FIELD_QUOTE);
		}
		if (ndx == -1 && (field.startsWith(SPACE) || field.endsWith(SPACE))) {
			ndx = 1;
		}
		if (ndx == -1) {
			ndx = StringUtils.indexOf(field, SPECIAL_CHARS);
		}

		// add field
		if (ndx != -1) {
			line.append(FIELD_QUOTE);
		}
		field = StringUtils.replace(field, QUOTE, DOUBLE_QUOTE);
		line.append(field);
		if (ndx != -1) {
			line.append(FIELD_QUOTE);
		}

		// last
		if (i != last) {
			line.append(FIELD_SEPARATOR);
		}
	}
	return line.toString();
}
 
Example 12
Source Project: jwala   File: TearDownStep.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Delete an OS service
 *
 * @param sshUser     the ssh user
 * @param sshPwd      the ssh password
 * @param serviceInfo information on the service to delete
 */
private void deleteService(String sshUser, String sshPwd, ServiceInfo serviceInfo) {
    final RemoteSystemConnection remoteSystemConnection
            = new RemoteSystemConnection(sshUser, sshPwd, serviceInfo.host, 22);

    RemoteCommandReturnInfo remoteCommandReturnInfo = null;
    RemoteCommandReturnInfo remoteCommandReturnInfoForStatus = null;
    try {
        remoteCommandReturnInfo = jschService.runShellCommand(remoteSystemConnection, "uname", SHORT_CONNECTION_TIMEOUT);
    } catch (JschServiceException jsch) {
        LOGGER.info("Unable to determine the os, hostname may be invalid");
        return;
    }
    LOGGER.info("Executed uname, result = {}", remoteCommandReturnInfo.standardOuput);
    final JwalaOsType osType = StringUtils.indexOf(remoteCommandReturnInfo.standardOuput, "CYGWIN") > -1 ?
            JwalaOsType.WINDOWS : JwalaOsType.UNIX;
    LOGGER.info("OS type = {}", osType);

    if (serviceInfo.isStarted()) {
        // Stop the service first so that service delete is executed by the OS asap
        switch (osType) {
            case WINDOWS:
                remoteCommandReturnInfo = jschService.runShellCommand(remoteSystemConnection, "sc stop " + serviceInfo.name, CONNECTION_TIMEOUT);
                remoteCommandReturnInfoForStatus = jschService.runShellCommand(remoteSystemConnection, "sc query " + serviceInfo.name + "|grep -i STOPPED", CONNECTION_TIMEOUT);
                if (null == remoteCommandReturnInfoForStatus.standardOuput || remoteCommandReturnInfoForStatus.standardOuput.equals("")) {
                    throw new TearDownException("Unable to stop the service" + serviceInfo.name);
                }
                break;
            case UNIX:
                remoteCommandReturnInfo = jschService.runShellCommand(remoteSystemConnection, "sudo service " + serviceInfo.name + " stop", CONNECTION_TIMEOUT);
                remoteCommandReturnInfoForStatus = jschService.runShellCommand(remoteSystemConnection, "sudo service " + serviceInfo.name + " status|grep -i STOPPED", CONNECTION_TIMEOUT);
                if (null == remoteCommandReturnInfoForStatus.standardOuput || remoteCommandReturnInfoForStatus.standardOuput.equals("")) {
                    throw new TearDownException("Unable to stop the service" + serviceInfo.name);
                }
                break;
            default:
                throw new TearDownException(
                        MessageFormat.format("I don't know how to stop services for os type -> {0}", osType));
        }
        LOGGER.info("Shell command executed = {}", remoteCommandReturnInfo.standardOuput);
    }

    // If the service state is NEW, that means that the service has not yet been created so let's not issue a
    // delete command to save some time
    if (!serviceInfo.isNew()) {
        switch (osType) {
            case WINDOWS:
                remoteCommandReturnInfo = jschService.runShellCommand(remoteSystemConnection, "sc delete " + serviceInfo.name, CONNECTION_TIMEOUT);
                break;
            case UNIX:
                remoteCommandReturnInfo = jschService.runShellCommand(remoteSystemConnection, "sudo chkconfig --del " + serviceInfo.name, CONNECTION_TIMEOUT);
                remoteCommandReturnInfo = jschService.runShellCommand(remoteSystemConnection, "sudo rm /etc/init.d/" + serviceInfo.name, CONNECTION_TIMEOUT);
                break;
            default:
                throw new TearDownException(
                        MessageFormat.format("I don't know how to delete services for os type -> {0}", osType));
        }
        LOGGER.info("Shell command executed = {}", remoteCommandReturnInfo.standardOuput);
    }
}
 
Example 13
Source Project: payment   File: HttpUtils.java    License: Apache License 2.0 4 votes vote down vote up
public static boolean isWechatBrowser(HttpServletRequest request) {
    String userAgent = StringUtils.lowerCase(request.getHeader("user-agent"));
    return StringUtils.indexOf(userAgent, "micromessenger") > 0;
}
 
Example 14
Source Project: Alink   File: VectorUtil.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Parse the sparse vector from a formatted string.
 *
 * <p>The format of a sparse vector is space separated index-value pairs, such as "0:1 2:3 3:4".
 * If the sparse vector has determined vector size, the size is prepended to the head. For example,
 * the string "$4$0:1 2:3 3:4" represents a sparse vector with size 4.
 *
 * @throws IllegalArgumentException If the string is of invalid format.
 */
public static SparseVector parseSparse(String str) {
	try {
		if (org.apache.flink.util.StringUtils.isNullOrWhitespaceOnly(str)) {
			return new SparseVector();
		}

		int n = -1;
		int firstDollarPos = str.indexOf(HEADER_DELIMITER);
		int lastDollarPos = -1;
		if (firstDollarPos >= 0) {
			lastDollarPos = StringUtils.lastIndexOf(str, HEADER_DELIMITER);
			String sizeStr = StringUtils.substring(str, firstDollarPos + 1, lastDollarPos);
			n = Integer.valueOf(sizeStr);
			if (lastDollarPos == str.length() - 1) {
				return new SparseVector(n);
			}
		}

		int numValues = StringUtils.countMatches(str, String.valueOf(INDEX_VALUE_DELIMITER));
		double[] data = new double[numValues];
		int[] indices = new int[numValues];
		int startPos = lastDollarPos + 1;
		int endPos;
		for (int i = 0; i < numValues; i++) {
			int colonPos = StringUtils.indexOf(str, INDEX_VALUE_DELIMITER, startPos);
			if (colonPos < 0) {
				throw new IllegalArgumentException("Format error.");
			}
			endPos = StringUtils.indexOf(str, ELEMENT_DELIMITER, colonPos);

			//to be compatible with previous delimiter
			if (endPos == -1) {
				endPos = StringUtils.indexOf(str, ",", colonPos);
			}

			if (endPos == -1) {
				endPos = str.length();
			}
			indices[i] = Integer.valueOf(str.substring(startPos, colonPos).trim());
			data[i] = Double.valueOf(str.substring(colonPos + 1, endPos).trim());
			startPos = endPos + 1;
		}
		return new SparseVector(n, indices, data);
	} catch (Exception e) {
		throw new IllegalArgumentException(
			String.format("Fail to getVector sparse vector from string: \"%s\".", str),
			e);
	}
}
 
Example 15
Source Project: smockin   File: RestfulMockServiceUtils.java    License: Apache License 2.0 4 votes vote down vote up
public String formatInboundPathVarArgs(final String inboundPath) {

        if (StringUtils.isBlank(inboundPath)) {
            return null;
        }

        final int varArgStart = StringUtils.indexOf(inboundPath, ":");

        if (varArgStart > -1) {

            final int varArgEnd = StringUtils.indexOf(inboundPath, "/", varArgStart);

            final String varArg = (varArgEnd > -1)
                    ? StringUtils.substring(inboundPath, varArgStart, varArgEnd)
                    : StringUtils.substring(inboundPath, varArgStart);

            final String result = StringUtils.replace(inboundPath, varArg, "{" + StringUtils.remove(varArg, ':') + "}");

            return formatInboundPathVarArgs(result);
        }

        return inboundPath;
    }
 
Example 16
Source Project: smockin   File: RestfulMockServiceUtils.java    License: Apache License 2.0 4 votes vote down vote up
public String formatOutboundPathVarArgs(final String outboundPath) {

        if (StringUtils.isBlank(outboundPath)) {
            return null;
        }

        final int varArgStart = StringUtils.indexOf(outboundPath, "{");

        if (varArgStart > -1) {

            final int varArgEnd = StringUtils.indexOf(outboundPath, "}", varArgStart);

            final String varArg = (varArgEnd > -1)
                    ? StringUtils.substring(outboundPath, varArgStart, varArgEnd + 1)
                    : StringUtils.substring(outboundPath, varArgStart);

            final String result = StringUtils.replace(outboundPath, varArg,
                    ":" + StringUtils.remove(StringUtils.remove(varArg, '{'), '}'));

            return formatOutboundPathVarArgs(result);
        }

        return outboundPath;
    }
 
Example 17
Source Project: flink   File: VectorUtil.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Parse the sparse vector from a formatted string.
 *
 * <p>The format of a sparse vector is space separated index-value pairs, such as "0:1 2:3 3:4".
 * If the sparse vector has determined vector size, the size is prepended to the head. For example,
 * the string "$4$0:1 2:3 3:4" represents a sparse vector with size 4.
 *
 * @param str A formatted string representing a sparse vector.
 * @throws IllegalArgumentException If the string is of invalid format.
 */
public static SparseVector parseSparse(String str) {
	try {
		if (org.apache.flink.util.StringUtils.isNullOrWhitespaceOnly(str)) {
			return new SparseVector();
		}

		int n = -1;
		int firstDollarPos = str.indexOf(HEADER_DELIMITER);
		int lastDollarPos = -1;
		if (firstDollarPos >= 0) {
			lastDollarPos = StringUtils.lastIndexOf(str, HEADER_DELIMITER);
			String sizeStr = StringUtils.substring(str, firstDollarPos + 1, lastDollarPos);
			n = Integer.valueOf(sizeStr);
			if (lastDollarPos == str.length() - 1) {
				return new SparseVector(n);
			}
		}

		int numValues = StringUtils.countMatches(str, String.valueOf(INDEX_VALUE_DELIMITER));
		double[] data = new double[numValues];
		int[] indices = new int[numValues];
		int startPos = lastDollarPos + 1;
		int endPos;
		for (int i = 0; i < numValues; i++) {
			int colonPos = StringUtils.indexOf(str, INDEX_VALUE_DELIMITER, startPos);
			if (colonPos < 0) {
				throw new IllegalArgumentException("Format error.");
			}
			endPos = StringUtils.indexOf(str, ELEMENT_DELIMITER, colonPos);

			if (endPos == -1) {
				endPos = str.length();
			}
			indices[i] = Integer.valueOf(str.substring(startPos, colonPos).trim());
			data[i] = Double.valueOf(str.substring(colonPos + 1, endPos).trim());
			startPos = endPos + 1;
		}
		return new SparseVector(n, indices, data);
	} catch (Exception e) {
		throw new IllegalArgumentException(
			String.format("Fail to getVector sparse vector from string: \"%s\".", str), e);
	}
}
 
Example 18
Source Project: bird-java   File: PoiExcelHelper.java    License: MIT License 4 votes vote down vote up
/**
 * 读取每一行的数据
 *
 * @param row       行数据
 * @param headKeys  keys
 * @param evaluator 公式计算器
 * @return 行数据
 */
private static Map<String, Object> readLine(Row row, List<String> headKeys, FormulaEvaluator evaluator) {
    if (row == null) return null;

    Map<String, Object> line = new HashMap<>(8);
    short max = row.getLastCellNum();
    for (short i = row.getFirstCellNum(); i < max; i++) {
        if (i >= headKeys.size()) break;

        Cell cell = row.getCell(i);
        if (cell == null) continue;

        String key = headKeys.get(i);
        Object value = null;
        CellType cellType = cell.getCellTypeEnum();
        switch (cellType) {
            case STRING:
                value = StringUtils.replaceAll(cell.getStringCellValue(),"^\\s*|\\s*$|\t|\r|\n","");
                break;
            case NUMERIC:
                if (HSSFDateUtil.isCellDateFormatted(cell)) {
                    value = HSSFDateUtil.getJavaDate(cell.getNumericCellValue());
                } else {
                    value = cell.getNumericCellValue();
                }
                break;
            case BOOLEAN:
                value = cell.getBooleanCellValue();
                break;
            case FORMULA:
                CellValue cellValue = evaluator.evaluate(cell);
                value = cellValue.getCellTypeEnum() == CellType.NUMERIC ? cellValue.getNumberValue() : cellValue.getStringValue();
                break;
            default:
                break;
        }

        if (value != null && Objects.equals(value.getClass().getName(), "java.lang.Double") && StringUtils.indexOf(value.toString(), "E") >= 0) {
            value = DECIMAL_FORMAT.format(value);
        }
        line.put(key, value);
    }
    return line;
}
 
Example 19
Source Project: Alink   File: VectorUtil.java    License: Apache License 2.0 3 votes vote down vote up
/**
 * Parse either a {@link SparseVector} or a {@link DenseVector} from a formatted string.
 *
 * <p>The format of a dense vector is space separated values such as "1 2 3 4".
 * The format of a sparse vector is space separated index-value pairs, such as "0:1 2:3 3:4".
 * If the sparse vector has determined vector size, the size is prepended to the head. For example,
 * the string "$4$0:1 2:3 3:4" represents a sparse vector with size 4.
 *
 * @param str A formatted string representing a vector.
 * @return The parsed vector.
 */
private static Vector parse(String str) {
	boolean isSparse = org.apache.flink.util.StringUtils.isNullOrWhitespaceOnly(str)
		|| StringUtils.indexOf(str, INDEX_VALUE_DELIMITER) != -1
		|| StringUtils.indexOf(str, HEADER_DELIMITER) != -1;
	if (isSparse) {
		return parseSparse(str);
	} else {
		return parseDense(str);
	}
}
 
Example 20
String extractArgName(final int matchStartPos, final ParamMatchTypeEnum paramMatchType, final String responseBody, final boolean isNested) {

        final int start = matchStartPos + (ParamMatchTypeEnum.PARAM_PREFIX + paramMatchType).length();
        final int closingPos = StringUtils.indexOf(responseBody, (isNested) ? "))" : ")", start);

        return StringUtils.substring(responseBody, start, closingPos);
    }