public abstract class StringUtils
extends java.lang.Object
String manipulation
methods.| Modifier and Type | Field and Description |
|---|---|
private static CharKeyOpenHashMap |
mHtmlEncodeMap |
| Modifier | Constructor and Description |
|---|---|
private |
StringUtils() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
convertTabsToSpaces(java.lang.String line,
int tabWidth)
Converts all tabs on a line to spaces according to the provided tab
width.
|
private static java.lang.String |
encode(java.lang.String source,
CharKeyOpenHashMap encodingTable)
Transforms a provided
String object into a new string,
using the mapping that are provided through the supplied encoding table. |
static java.lang.String |
encodeHtml(java.lang.String source)
Transforms a provided
String object into a new string,
containing only valid Html characters. |
static boolean |
filter(java.lang.String name,
java.util.regex.Pattern[] included,
java.util.regex.Pattern[] excluded)
Checks if the name filters through a series of including and excluding
regular expressions.
|
static boolean |
filter(java.lang.String name,
java.util.regex.Pattern included,
java.util.regex.Pattern excluded)
Checks if the name filters through an including and an excluding
regular expression.
|
static java.lang.String |
repeat(java.lang.String source,
int count)
Creates a new string that contains the provided string a number of times.
|
static java.lang.String |
replace(java.lang.String source,
java.lang.String stringToReplace,
java.lang.String replacementString)
Searches for a string within a specified string in a case-sensitive
manner and replaces every match with another string.
|
static java.lang.String |
replace(java.lang.String source,
java.lang.String stringToReplace,
java.lang.String replacementString,
boolean matchCase)
Searches for a string within a specified string and replaces every match
with another string.
|
static java.util.ArrayList |
split(java.lang.String source,
java.lang.String seperator)
Splits a string into different parts, using a seperator string to detect
the seperation boundaries in a case-sensitive manner.
|
static java.util.ArrayList |
split(java.lang.String source,
java.lang.String seperator,
boolean matchCase)
Splits a string into different parts, using a seperator string to detect
the seperation boundaries.
|
private static final CharKeyOpenHashMap mHtmlEncodeMap
public static java.lang.String encodeHtml(java.lang.String source)
String object into a new string,
containing only valid Html characters.source - The string that has to be transformed into a valid Html
string.String object.private static java.lang.String encode(java.lang.String source,
CharKeyOpenHashMap encodingTable)
String object into a new string,
using the mapping that are provided through the supplied encoding table.source - The string that has to be transformed into a valid string,
using the mappings that are provided through the supplied encoding table.encodingTables - A Map object containing the mappings to
transform characters into valid entities. The keys of this map should be
Character objects and the values String
objects.String object.public static boolean filter(java.lang.String name,
java.util.regex.Pattern included,
java.util.regex.Pattern excluded)
name - The String that will be filtered.included - The regular expressions that needs to succeedexcluded - The regular expressions that needs to failtrue if the name filtered through correctly; or
false otherwise.
public static boolean filter(java.lang.String name,
java.util.regex.Pattern[] included,
java.util.regex.Pattern[] excluded)
name - The String that will be filtered.included - An array of regular expressions that need to succeedexcluded - An array of regular expressions that need to failtrue if the name filtered through correctly; or
false otherwise.
public static java.util.ArrayList split(java.lang.String source,
java.lang.String seperator)
source - The string that will be split into parts.seperator - The seperator string that will be used to determine the
parts.ArrayList containing the parts as
String objects.public static java.util.ArrayList split(java.lang.String source,
java.lang.String seperator,
boolean matchCase)
source - The string that will be split into parts.seperator - The seperator string that will be used to determine the
parts.matchCase - A boolean indicating if the match is going
to be performed in a case-sensitive manner or not.ArrayList containing the parts as
String objects.public static java.lang.String replace(java.lang.String source,
java.lang.String stringToReplace,
java.lang.String replacementString)
source - The string in which the matching parts will be replaced.stringToReplace - The string that will be searched for.replacementString - The string that will replace each matching part.String object containing the replacement
result.public static java.lang.String replace(java.lang.String source,
java.lang.String stringToReplace,
java.lang.String replacementString,
boolean matchCase)
source - The string in which the matching parts will be replaced.stringToReplace - The string that will be searched for.replacementString - The string that will replace each matching part.matchCase - A boolean indicating if the match is going
to be performed in a case-sensitive manner or not.String object containing the replacement
result.public static java.lang.String repeat(java.lang.String source,
int count)
source - The string that will be repeated.count - The number of times that the string will be repeated.String object containing the repeated
concatenation result.public static java.lang.String convertTabsToSpaces(java.lang.String line,
int tabWidth)
line - The line whose tabs have to be converted.tabWidth - The tab width.String object containing the line with the
replaced tabs.