|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectlv.gotika.engine.util.StringBuilderExt
public final class StringBuilderExt
Class contains frequently used string operations that are not provided by Java standard library.
| Constructor Summary | |
|---|---|
StringBuilderExt()
|
|
| Method Summary | |
|---|---|
static int |
count(String s,
String target)
For the given string counts the frequency of a specific substring. |
static StringBuilder |
replace(StringBuilder sb,
String target,
String replacement)
Replaces each substring of the given string buffer that matches the given substring with the given replacement. |
static StringBuilder |
replaceEnd(StringBuilder sb,
String target,
String replacement)
If the given string buffer ends with a certain substring then it is substituted with the given replacement. |
static StringBuilder |
replaceStart(StringBuilder sb,
String target,
String replacement)
If the given string buffer begins with a certain substring then it is substituted with the given replacement. |
static String |
trimEnd(String s)
Cuts off all the whitespaces (if any) that the given string ends with. |
static StringBuilder |
trimEnd(StringBuilder s)
Cuts off all the whitespaces (if any) that the given string buffer ends with. |
static String |
trimStart(String s)
Cuts off all the whitespaces (if any) that the given string starts with. |
static StringBuilder |
trimStart(StringBuilder s)
Cuts off all the whitespaces (if any) that the given string buffer starts with. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public StringBuilderExt()
| Method Detail |
|---|
public static StringBuilder replace(StringBuilder sb,
String target,
String replacement)
Example: replace(new StringBuilder("aaa"), "a", "ba")
returns bababa.
sb - a string buffer.target - a substring of interest.replacement - a replacement string.
public static StringBuilder replaceStart(StringBuilder sb,
String target,
String replacement)
sb - a string buffer.target - a substring of interest.replacement - a replacement string.
public static StringBuilder replaceEnd(StringBuilder sb,
String target,
String replacement)
sb - a string buffer.target - a substring of interest.replacement - a replacement string.
public static int count(String s,
String target)
Example: count("aabaaa", "aa") returns 2.
s - a string.target - a substring of interest.
public static StringBuilder trimStart(StringBuilder s)
s - a string buffer.
public static String trimStart(String s)
s - a string.
public static StringBuilder trimEnd(StringBuilder s)
s - a string buffer.
public static String trimEnd(String s)
s - a string.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||