/** * Remove line breaks. */ public static String removeLineBreaks(String s) { if (lineSeparators == null) { lineSeparators = getLineSeparators(); } for (int i = 0; i < lineSeparators.length; i++) { s = replace(s, lineSeparators[i], SPACE); } return s; }
/** * Remove line breaks. */ public static String removeLineBreaks(String s) { if (lineSeparators == null) { lineSeparators = getLineSeparators(); } for (int i = 0; i < lineSeparators.length; i++) { s = replace(s, lineSeparators[i], SPACE); } return s; }
/** * If a decimal number contains thousand separator (example : a coma in US), * they are removed, so that the string can be correctly interpreted by Double.parseDouble * @ibm-api */ public static String removeThousandSeparator(String doubleString, Locale loc) { DecimalFormatSymbols symb = new DecimalFormatSymbols(loc); char thoSep = symb.getGroupingSeparator(); if (thoSep=='.') { // don't remove thousand separator if it is a '.' return doubleString; } if (thoSep==160) { // insecable white space thoSep=' '; } return StringUtil.replace(doubleString, String.valueOf(thoSep), null); }
/** * If a decimal number contains thousand separator (example : a coma in US), * they are removed, so that the string can be correctly interpreted by Double.parseDouble */ public static String removeThousandSeparator(String doubleString, Locale loc) { DecimalFormatSymbols symb = new DecimalFormatSymbols(loc); char thoSep = symb.getGroupingSeparator(); if (thoSep=='.') { // don't remove thousand separator if it is a '.' return doubleString; } if (thoSep==160) { // insecable white space thoSep=' '; } return StringUtil.replace(doubleString, String.valueOf(thoSep), null); }
/** * If a decimal number contains thousand separator (example : a coma in US), * they are removed, so that the string can be correctly interpreted by Double.parseDouble */ public static String removeThousandSeparator(String doubleString, Locale loc) { DecimalFormatSymbols symb = new DecimalFormatSymbols(loc); char thoSep = symb.getGroupingSeparator(); if (thoSep=='.') { // don't remove thousand separator if it is a '.' return doubleString; } if (thoSep==160) { // insecable white space thoSep=' '; } return StringUtil.replace(doubleString, String.valueOf(thoSep), null); }
/** * If a decimal number contains thousand separator (example : a coma in US), * they are removed, so that the string can be correctly interpreted by Double.parseDouble * @ibm-api */ public static String removeThousandSeparator(String doubleString, Locale loc) { DecimalFormatSymbols symb = new DecimalFormatSymbols(loc); char thoSep = symb.getGroupingSeparator(); if (thoSep=='.') { // don't remove thousand separator if it is a '.' return doubleString; } if (thoSep==160) { // insecable white space thoSep=' '; } return StringUtil.replace(doubleString, String.valueOf(thoSep), null); }
/** * Replace any of the listed values with the specified replacement in the source string. * * @param source * @param values * @param replace * @return string with updated value */ private String replace(String source, String[] values, String[] replaces) { if (StringUtil.isEmpty(source) || values == null || replaces == null) { return ""; //$NON-NLS-1$ } for (int i=0; i<values.length; i++) { source = StringUtil.replace(source, values[i], replaces[i]); } return source; }
/** * Formats the Url pattern contained on this object with the provided NamedUrlParts * @param args * @return {String} */ public String format(NamedUrlPart... args){ List<NamedUrlPart> namedParts = Arrays.asList(args); String url = this.urlPattern; for (NamedUrlPart namedPart : namedParts) { url = StringUtil.replace(url, LEFT_BRACE + namedPart.getName() + RIGHT_BRACE, namedPart.getValue()); } checkNoMissingParameters(url); return url.replaceAll(DOUBLE_SLASH, SLASH); }
public XPathExpression getFacetPath(String value) { return compile(StringUtil.replace(path.getExpression(), "{facet.id}", value)); }