List of utility methods to do String Substritute
String | substituteMarkers(String sql, String marker, Object substitution) substitute Markers return sql.replace(marker, renderValue(substitution));
|
String | substituteNull(String value, String substitution) substitute Null return (value != null ? value : substitution);
|
String | substitutePropertyWithIn(String propertyName, String replacementString, String evaluatedString) Substitute property with in. replacementString = replacementString.replace("\\", "\\\\"); return evaluatedString.replaceAll("\\$\\{" + propertyName + "\\}", replacementString); |
String | substituteSelectedCharacters(String text, boolean skip) Substitutes the selected characters with entities. if (text != null) { StringBuffer newText = new StringBuffer(); for (int i = 0; i < text.length(); i++) { char character = text.charAt(i); if (character == '<') { if (skip) newText.append("<"); else ... |
String | substituteSpaces(String originalPath) substituteSpaces substitutes %20 in spaces in a path (MacOS X) if (originalPath == null) return ""; StringBuffer s = new StringBuffer(originalPath); for (int i = 0; i < s.length(); i++) { if (s.charAt(i) == ' ') { s.setCharAt(i, '0'); s.insert(i++, '%'); s.insert(i++, '2'); ... |
String | substituteSubString(String input, String find, String replace) Replace substrings of one string with another string and return altered string. int find_length = find.length(); int replace_length = replace.length(); StringBuffer output = new StringBuffer(input); int index = input.indexOf(find); int outputOffset = 0; while (index > -1) { output.replace(index + outputOffset, index + outputOffset + find_length, replace); outputOffset = outputOffset + (replace_length - find_length); ... |
String | substituteSymbol(String text, String symbol, String value) String substitution routine. StringBuffer buffer; while (text.indexOf(symbol) >= 0) { buffer = new StringBuffer(text); buffer.replace(text.indexOf(symbol), text.indexOf(symbol) + symbol.length(), value); text = buffer.toString(); return text; |
String | substituteSymbol(String text, String symbol, String value) substitute Symbol StringBuffer buffer; while (text.indexOf(symbol) >= 0) { buffer = new StringBuffer(text); buffer.replace(text.indexOf(symbol), text.indexOf(symbol) + symbol.length(), value); text = buffer.toString(); return text; |
String | substituteTabsAndNewLinesWithSpaces(String str) substitute Tabs And New Lines With Spaces return str.replaceAll("\\t", " ").replaceAll("\\n", " "); |
String | substituteText(String text, String token, String substitute) Renders a string based on text where any occurence of token is replaced by substitute .
int index; if (token == null || substitute == null || (index = text.indexOf(token)) < 0) return text; while (index > -1) { text = text.substring(0, index) + substitute + text.substring(index + token.length()); index = text.indexOf(token); return text; ... |