public final class STR extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
form(String pattern,
Object... args)
Performs a multiple argument substitution for the 'pattern' passed as parameter.
|
static String |
form(String pattern,
Object arg)
Performs single argument substitution for the 'pattern' passed as parameter.
|
static String |
form(String pattern,
Object arg1,
Object arg2)
Performs a two argument substitution for the 'pattern' passed as parameter.
|
static String |
substr(String value,
int start,
int end)
Similar to substring from the
String class but with more error handling. |
public static String substr(String value, int start, int end)
String class but with more error handling. It is also possible to set
the end value bigger then the String is longvalue - Original stringstart - start value from the substringend - end value from the substringpublic static String form(String pattern, Object arg)
For example,
STR.form("Hi {}.", "there");
will return the string "Hi there.".
pattern - The pattern which will be parsed and formattedarg - The argument to be substituted in place of the formatting anchorpublic static String form(String pattern, Object arg1, Object arg2)
For example,
STR.form("Hi {}. My name is {}.", "Alice", "Bob");
will return the string "Hi Alice. My name is Bob.".
pattern - The pattern which will be parsed and formattedarg1 - The first argument to be substituted in place of the formatting anchorarg2 - The second argument to be substituted in place of the formatting anchorpublic static String form(String pattern, Object... args)
For example,
STR.form("Hi {}. My name is {} and i am {} years old.", "Alice", "Bob", 27);
will return the string "Hi Alice. My name is Bob and i am 27 years old.".
pattern - The pattern which will be parsed and formattedargs - The arguments to be substituted in place of the formatting anchorCopyright © 2018. All rights reserved.