public class Strings extends Object
Modifier and Type | Method and Description |
---|---|
static String |
asString(Collection<?> collection)
Make a printable string from a collection using the tools here.
|
static String |
asString(double d)
Make a minimal printable string from a double value.
|
static String |
asString(Map<?,?> map)
Make a minimal printable string value from a typed map.
|
static String |
asString(Object o)
Make an object into a string using the typed tools here.
|
static String |
c_case(String name)
Format a prefixed name as c_case.
|
static String |
c_case(String prefix,
String name)
Format a prefixed name as c_case.
|
static String |
c_case(String prefix,
String name,
String suffix)
Format a prefixed name as c_case.
|
static String |
camelCase(String prefix,
String name)
Format a prefixed name as camelCase.
|
static String |
capitalize(String string) |
static int |
commonOverlap(String text1,
String text2)
Determine if the suffix of one string is the prefix of another.
|
static int |
commonPrefix(String text1,
String text2)
Determine the common prefix of two strings
|
static int |
commonSuffix(String text1,
String text2)
Determine the common suffix of two strings
|
static String |
escape(char c)
Escape a single character.
|
static String |
escape(CharSequence string)
Properly java-escape the string for printing to console.
|
static boolean |
isInteger(String key)
Check if the string is representing an integer (or long) value.
|
static <T> String |
join(String delimiter,
Collection<T> strings)
Join collection with delimiter.
|
static String |
join(String delimiter,
Object... values)
Join set of arbitrary values with delimiter.
|
static String |
joinP(String delimiter,
boolean... values)
Join array with delimiter.
|
static String |
joinP(String delimiter,
char... chars)
Join array with delimiter.
|
static String |
joinP(String delimiter,
double... values)
Join array with delimiter.
|
static String |
joinP(String delimiter,
int... values)
Join array with delimiter.
|
static String |
joinP(String delimiter,
long... values)
Join array with delimiter.
|
static String |
times(String s,
int num)
Multiply a string N times.
|
static String |
unescapeForEncodeUriCompatability(String str)
Unescape selected chars for compatability with JavaScript's encodeURI.
|
public static String escape(CharSequence string)
string
- The string to escape.public static String escape(char c)
c
- The char to escape.public static String unescapeForEncodeUriCompatability(String str)
Example: "%3F" -> "?", "%24" -> "$", etc.
str
- The string to escape.public static String join(String delimiter, Object... values)
delimiter
- The delimiter.values
- The values to join.public static String joinP(String delimiter, char... chars)
delimiter
- The delimiter.chars
- The char array to join.public static String joinP(String delimiter, int... values)
delimiter
- The delimiter.values
- The int array to join.public static String joinP(String delimiter, long... values)
delimiter
- The delimiter.values
- The int array to join.public static String joinP(String delimiter, double... values)
delimiter
- The delimiter.values
- The double array to join.public static String joinP(String delimiter, boolean... values)
delimiter
- The delimiter.values
- The double array to join.public static <T> String join(String delimiter, Collection<T> strings)
T
- Collection item type.delimiter
- The delimiter.strings
- The string collection to join.public static boolean isInteger(String key)
key
- The key to check if is an integer.public static String times(String s, int num)
s
- The string to multiply.num
- Npublic static String camelCase(String prefix, String name)
prefix
- The prefix.name
- The name to camel-case.public static String c_case(String prefix, String name, String suffix)
prefix
- The prefix.name
- The name to c-case.suffix
- The suffix.public static String c_case(String prefix, String name)
Note that this will mangle upper-case abbreviations.
prefix
- The prefix.name
- The name to c-case.public static String c_case(String name)
Note that this may mangle upper-case abbreviations.
name
- The name to c-case.public static String asString(double d)
d
- The double value.public static String asString(Collection<?> collection)
collection
- The collection to stringify.public static String asString(Map<?,?> map)
map
- The map to stringify.public static String asString(Object o)
o
- The object to stringify.public static int commonPrefix(String text1, String text2)
text1
- First string.text2
- Second string.public static int commonSuffix(String text1, String text2)
text1
- First string.text2
- Second string.public static int commonOverlap(String text1, String text2)
text1
- First string.text2
- Second string.Copyright © 2017. All rights reserved.