public class StrUtils extends Object
Modifier and Type | Field and Description |
---|---|
static int |
CMP_EQUAL |
static int |
CMP_GREATER |
static int |
CMP_INDETERMINATE |
static int |
CMP_LESS |
static int |
CMP_UNEQUAL |
Modifier and Type | Method and Description |
---|---|
static byte[] |
asUTF8bytes(String s) |
static String |
chop(String x) |
static boolean |
contains(String str1,
String str2)
Does one string contain another string?
|
static String |
decodeHex(String str,
char marker)
Decode a string using marked hex values e.g.
|
static String |
encodeHex(String str,
char marker,
char[] escapees)
Encode a string using hex values e.g.
|
static String |
escapeString(String x) |
static String |
fromUTF8bytes(byte[] bytes) |
static String |
noNewlineEnding(String x) |
static String |
replace(String string,
String target,
String replacement) |
static String[] |
split(String s,
String splitStr)
Split but also trim whiespace.
|
static String |
str(Object x) |
static int |
strCompare(String s1,
String s2) |
static int |
strCompareIgnoreCase(String s1,
String s2) |
static String |
strform(Map<String,String> subs,
String... args) |
static String |
strjoin(String sep,
List<String> args)
Concatentate string, using a separator
|
static String |
strjoin(String sep,
String... args)
Concatentate strings, using a separator
|
static String |
strjoinNL(List<String> args)
strjoin with a newline as the separator
|
static String |
strjoinNL(String... args)
strjoin with a newline as the separator
|
static String |
substitute(String str,
Map<String,String> subs) |
static List<Character> |
toCharList(String str) |
static String |
unescapeString(String x) |
public static final int CMP_GREATER
public static final int CMP_EQUAL
public static final int CMP_LESS
public static final int CMP_UNEQUAL
public static final int CMP_INDETERMINATE
public static String strjoin(String sep, String... args)
public static String strjoin(String sep, List<String> args)
public static byte[] asUTF8bytes(String s)
public static String fromUTF8bytes(byte[] bytes)
public static final boolean contains(String str1, String str2)
str1
- str2
- public static String encodeHex(String str, char marker, char[] escapees)
str
- String to encodemarker
- Marker characterescapees
- Characters to encode (must include the marker)public static String decodeHex(String str, char marker)
str
- String to decodemarker
- The marker charcaterLicenced under the Apache License, Version 2.0