Refine search
/** * <p>Gets the range as a <code>String</code>.</p> * * <p>The format of the String is 'Range[<i>min</i>,<i>max</i>]'.</p> * * @return the <code>String</code> representation of this range */ public String toString() { if (toString == null) { StrBuilder buf = new StrBuilder(32); buf.append("Range["); buf.append(min); buf.append(','); buf.append(max); buf.append(']'); toString = buf.toString(); } return toString; }
/** * Checks if the specified variable is already in the stack (list) of variables. * * @param varName the variable name to check * @param priorVariables the list of prior variables */ private void checkCyclicSubstitution(String varName, List priorVariables) { if (priorVariables.contains(varName) == false) { return; } StrBuilder buf = new StrBuilder(256); buf.append("Infinite loop in property interpolation of "); buf.append(priorVariables.remove(0)); buf.append(": "); buf.appendWithSeparators(priorVariables, "->"); throw new IllegalStateException(buf.toString()); }
/** * Replaces all the occurrences of variables with their matching values * from the resolver using the given source string as a template. * * @param source the string to replace in, null returns null * @return the result of the replace operation */ public String replace(String source) { if (source == null) { return null; } StrBuilder buf = new StrBuilder(source); if (substitute(buf, 0, source.length()) == false) { return source; } return buf.toString(); }
/** * Concatenate strings with a separator * * @param stringList * @param defaultEmptyValue * @return */ protected String getListWithSeparator(List<String> stringList, String defaultEmptyValue) { final String SEPARATOR = " "; StrBuilder builder = new StrBuilder(); builder = builder.appendWithSeparators(stringList, SEPARATOR); return builder.isEmpty() ? defaultEmptyValue : builder.toString(); }
/** * <p>Gets the range as a <code>String</code>.</p> * * <p>The format of the String is 'Range[<i>min</i>,<i>max</i>]'.</p> * * @return the <code>String</code> representation of this range */ public String toString() { if (toString == null) { StrBuilder buf = new StrBuilder(32); buf.append("Range["); buf.append(min); buf.append(','); buf.append(max); buf.append(']'); toString = buf.toString(); } return toString; }
private String createSummaryString(int truncateLength) { StrBuilder httpString = new StrBuilder(); httpString.append(protocolVersion).append(" ").append(statusCode).append(" ").append(statusMessage); httpString.appendNewLine(); httpString.appendWithSeparators(headers, SystemUtils.LINE_SEPARATOR); if (StringUtils.isNotEmpty(content)) { httpString.appendNewLine(); httpString.appendNewLine(); httpString.append(StringUtils.abbreviate(content, truncateLength)); } return httpString.toString(); }
/** * <p>Reverses a String as per {@link StrBuilder#reverse()}.</p> * * <p>A <code>null</code> String returns <code>null</code>.</p> * * <pre> * StringUtils.reverse(null) = null * StringUtils.reverse("") = "" * StringUtils.reverse("bat") = "tab" * </pre> * * @param str the String to reverse, may be null * @return the reversed String, <code>null</code> if null String input */ public static String reverse(String str) { if (str == null) { return null; } return new StrBuilder(str).reverse().toString(); }
/** * <p>Gets the range as a <code>String</code>.</p> * * <p>The format of the String is 'Range[<i>min</i>,<i>max</i>]'.</p> * * @return the <code>String</code> representation of this range */ public String toString() { if (toString == null) { StrBuilder buf = new StrBuilder(32); buf.append("Range["); buf.append(min); buf.append(','); buf.append(max); buf.append(']'); toString = buf.toString(); } return toString; }
private String createSummaryString(int truncateLength) { StrBuilder httpString = new StrBuilder(); httpString.append(protocolVersion).append(" ").append(statusCode).append(" ").append(statusMessage); httpString.appendNewLine(); httpString.appendWithSeparators(headers, SystemUtils.LINE_SEPARATOR); if (StringUtils.isNotEmpty(content)) { httpString.appendNewLine(); httpString.appendNewLine(); httpString.append(StringUtils.abbreviate(content, truncateLength)); } return httpString.toString(); }
private static String removeEnclosure( String stringToSplit, String enclosure ) { int firstIndex = stringToSplit.indexOf( enclosure ); int lastIndex = stringToSplit.lastIndexOf( enclosure ); if ( firstIndex == lastIndex ) { return stringToSplit; } StrBuilder strBuilder = new StrBuilder( stringToSplit ); strBuilder.replace( firstIndex, enclosure.length() + firstIndex, "" ); strBuilder.replace( lastIndex - enclosure.length(), lastIndex, "" ); return strBuilder.toString(); }
/** * <p>Gets the range as a <code>String</code>.</p> * * <p>The format of the String is 'Range[<i>min</i>,<i>max</i>]'.</p> * * @return the <code>String</code> representation of this range */ public String toString() { if (toString == null) { StrBuilder buf = new StrBuilder(32); buf.append("Range["); buf.append(min); buf.append(','); buf.append(max); buf.append(']'); toString = buf.toString(); } return toString; }
/** * Checks if the specified variable is already in the stack (list) of variables. * * @param varName the variable name to check * @param priorVariables the list of prior variables */ private void checkCyclicSubstitution(String varName, List priorVariables) { if (priorVariables.contains(varName) == false) { return; } StrBuilder buf = new StrBuilder(256); buf.append("Infinite loop in property interpolation of "); buf.append(priorVariables.remove(0)); buf.append(": "); buf.appendWithSeparators(priorVariables, "->"); throw new IllegalStateException(buf.toString()); }
StrBuilder afterConvert = new StrBuilder(inputSql); for (Pair<Integer, Integer> pos : tablesPos) { String tableWithSchema = schema + "." + inputSql.substring(pos.getFirst(), pos.getSecond()); afterConvert.replace(pos.getFirst(), pos.getSecond(), tableWithSchema); return afterConvert.toString();
/** * Replaces all the occurrences of variables with their matching values * from the resolver using the given source array as a template. * The array is not altered by this method. * * @param source the character array to replace in, not altered, null returns null * @return the result of the replace operation */ public String replace(char[] source) { if (source == null) { return null; } StrBuilder buf = new StrBuilder(source.length).append(source); substitute(buf, 0, source.length); return buf.toString(); }
/** * Checks if the specified variable is already in the stack (list) of variables. * * @param varName the variable name to check * @param priorVariables the list of prior variables */ private void checkCyclicSubstitution(String varName, List priorVariables) { if (priorVariables.contains(varName) == false) { return; } StrBuilder buf = new StrBuilder(256); buf.append("Infinite loop in property interpolation of "); buf.append(priorVariables.remove(0)); buf.append(": "); buf.appendWithSeparators(priorVariables, "->"); throw new IllegalStateException(buf.toString()); }
- startMatchLen); if (isEnableSubstitutionInVariables()) { StrBuilder bufName = new StrBuilder(varName); substitute(bufName, 0, bufName.length()); varName = bufName.toString();
/** * <p>Capitalizes a String changing the first letter to title case as * per {@link Character#toTitleCase(char)}. No other letters are changed.</p> * * <p>For a word based algorithm, see {@link WordUtils#capitalize(String)}. * A <code>null</code> input String returns <code>null</code>.</p> * * <pre> * StringUtils.capitalize(null) = null * StringUtils.capitalize("") = "" * StringUtils.capitalize("cat") = "Cat" * StringUtils.capitalize("cAt") = "CAt" * </pre> * * @param str the String to capitalize, may be null * @return the capitalized String, <code>null</code> if null String input * @see WordUtils#capitalize(String) * @see #uncapitalize(String) * @since 2.0 */ public static String capitalize(String str) { int strLen; if (str == null || (strLen = str.length()) == 0) { return str; } return new StrBuilder(strLen) .append(Character.toTitleCase(str.charAt(0))) .append(str.substring(1)) .toString(); }
/** * Checks if the specified variable is already in the stack (list) of variables. * * @param varName the variable name to check * @param priorVariables the list of prior variables */ private void checkCyclicSubstitution(String varName, List priorVariables) { if (priorVariables.contains(varName) == false) { return; } StrBuilder buf = new StrBuilder(256); buf.append("Infinite loop in property interpolation of "); buf.append(priorVariables.remove(0)); buf.append(": "); buf.appendWithSeparators(priorVariables, "->"); throw new IllegalStateException(buf.toString()); }
/** * Copy constructor. Creates a deep copy so no parts are shared. * * @param toBeCopied the Url to be copied */ public Url(Url toBeCopied) { this.url = new StrBuilder(toBeCopied.url.toString()); this.queryParams = new ArrayList<QueryParam>(toBeCopied.queryParams); }
/** * <p>Gets a string representation of the character range.</p> * * @return string representation of this range */ public String toString() { if (iToString == null) { StrBuilder buf = new StrBuilder(4); if (isNegated()) { buf.append('^'); } buf.append(start); if (start != end) { buf.append('-'); buf.append(end); } iToString = buf.toString(); } return iToString; }