public class StringUtil extends Object
Constructor and Description |
---|
StringUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
appendN(char c,
int n,
StringBuilder sb)
Appends the specified character n times to the supplied StringBuilder.
|
static String |
concat(String... strings)
Concatenate a number of Strings.
|
static String[] |
decodeArray(String encodedArray)
Decodes a String generated by encodeArray.
|
static String |
deriveInitialText(String text)
Derives the initial text from the supplied text.
|
static String |
encodeArray(String[] array)
Encodes an array of Strings into a single String than can be decoded to the original array using the
corresponding decode method.
|
static String |
getAllAfter(String string,
char separatorChar)
Returns all text occurring after the specified separator character, or the entire string when the seperator char
does not occur.
|
static String |
getAllBefore(String string,
char separatorChar)
Returns all text occurring before the specified separator character, or the entire string when the seperator char
does not occur.
|
static String |
gsub(String olds,
String news,
String text)
Substitute String "old" by String "new" in String "text" everywhere.
|
static boolean |
isGarbageText(String text)
Titles shorter than MIN_TITLE_LENGTH and long titles that don't contain a single space character are considered
to be garbage.
|
static String |
trimDoubleQuotes(String text)
Removes the double quote from the start and end of the supplied string if it starts and ends with this character.
|
public static String gsub(String olds, String news, String text)
olds
- The String to be substituted.news
- The String is the new content.text
- The String in which the substitution is done.public static String getAllAfter(String string, char separatorChar)
string
- The string of which the substring needs to be determined.separatorChar
- The character to look for.public static String getAllBefore(String string, char separatorChar)
string
- The string of which the substring needs to be determined.separatorChar
- The character to look for.public static String encodeArray(String[] array)
public static String[] decodeArray(String encodedArray)
public static String deriveInitialText(String text)
public static boolean isGarbageText(String text)
public static void appendN(char c, int n, StringBuilder sb)
c
- The character to append.n
- The number of times the character should be appended.sb
- The StringBuilder to append the character(s) to.public static String trimDoubleQuotes(String text)
text
- The string to remove the double quotes from.Copyright © 2015-2019 Eclipse Foundation. All Rights Reserved.