| java.lang.Object org.openlaszlo.utils.StringUtils
StringUtils | abstract public class StringUtils (Code) | | A utility class containing string utility functions.
author: Oliver Steele |
Method Summary | |
public static String | expandPropertyValues(String str) Expand property values in a string. | public static int | indexOf(String str, String value, int offset) Return the index of the first occurrence of value in str that
is later than or equal to offset. | public static String | join(String[] lines, String delim) Returns a single string that interpolates the strings in
lines by the delimiters delim. | public static String | join(List words, String delim) | public static String | normalizeLineEndings(String src) Turn CRs into LFs.
Note: not implemented for DOS (CRLF) line feeds. | public static int | parseInt(String src) | public static String | replace(String str, char oldChar, String newStr) Replaces old character with new string. | public static String | replace(String str, String oldStr, String newStr) Replaces old string with new string. | public static String | setCharAt(String str, int x, char c) | public static String[] | split(String str, String delim) Splits a string containing n occurrences of
delim into n+1 strings that don't contain
delim (and whose occurrences in str are
bounded by delim). |
expandPropertyValues | public static String expandPropertyValues(String str) throws Exception(Code) | | Expand property values in a string. Property values need to be enclosed
in ${}. For example, the string
"${file.separator}lps${file.separator}logs" will be converted to
"/lps/logs".
Parameters: str - string to expand property values expanded string or null, if a property variable wasn't closedproperly or a specified property value doesn't exist. |
indexOf | public static int indexOf(String str, String value, int offset)(Code) | | Return the index of the first occurrence of value in str that
is later than or equal to offset.
Parameters: str - a String Parameters: value - a String Parameters: offset - a String an int |
join | public static String join(String[] lines, String delim)(Code) | | Returns a single string that interpolates the strings in
lines by the delimiters delim.
For example, join({"a","b","c"}, ",") would
evaluate to "a,b,c" (if Java had a literal
expression notation for arrays).
Parameters: lines - a String[] value Parameters: delim - a char value a String value |
normalizeLineEndings | public static String normalizeLineEndings(String src)(Code) | | Turn CRs into LFs.
Note: not implemented for DOS (CRLF) line feeds. Will turn
them into double lines, which will mess up multi-line string
literals.
Parameters: src - a string a string |
parseInt | public static int parseInt(String src)(Code) | | Parse an int, interpreting a leading 0x or # to mean
the text is in hexidecimal
Parameters: src - a string |
replace | public static String replace(String str, char oldChar, String newStr)(Code) | | Replaces old character with new string.
Parameters: str - string to replace old character with new string Parameters: oldChar - old character to replace in string Parameters: newStr - new string to replace old character with string with replaced string |
replace | public static String replace(String str, String oldStr, String newStr)(Code) | | Replaces old string with new string.
Parameters: str - string to replace old character with new string Parameters: oldStr - old string to replace in string Parameters: newStr - new string to replace old character with string with replaced string |
setCharAt | public static String setCharAt(String str, int x, char c) throws IndexOutOfBoundsException(Code) | | Replace index in string with given character
Parameters: str - string to start with Parameters: x - to use Parameters: c - to replace with str with char replaced |
split | public static String[] split(String str, String delim)(Code) | | Splits a string containing n occurrences of
delim into n+1 strings that don't contain
delim (and whose occurrences in str are
bounded by delim).
For example, split("a,b,,c", ",") evaluates to
{"a", "b", "", "c"} .
split("/", "/") -> ["", ""]
Parameters: str - a String value Parameters: delim - a char value a String[] value
|
|
|