public final class Strings extends Object
This class provides convenience operations for strings.
Modifier and Type | Field and Description |
---|---|
static String |
UTF16
UTF16 encoding string.
|
static String |
UTF16BE
UTF16BE encoding string.
|
static String |
UTF16LE
UTF16 encoding string.
|
static String |
UTF32
UTF16 encoding string.
|
static String |
UTF8
UTF8 encoding string.
|
Modifier and Type | Method and Description |
---|---|
static String |
camelCase(String string)
Converts the given string to camel case.
|
static boolean |
contains(String string,
char ch)
Checks if a character occurs in a strings.
|
static String |
delete(String string,
char ch)
Deletes a character from the strings.
|
static boolean |
eq(String str,
String... strings)
Compares several strings for equality.
|
static boolean |
eq(String str1,
String str2)
Compares two strings for equality.
|
static boolean |
eqic(String str,
String... strings)
Compares several strings for equality, ignoring the case.
|
static String |
md5(String string)
Returns an MD5 hash in lower case.
|
static boolean |
no(String string)
Checks if the specified string is "no", "false", "off" or "0".
|
static String |
normEncoding(String encoding)
Returns a unified representation of the specified encoding.
|
static String |
normEncoding(String encoding,
boolean utf16)
Returns a unified representation of the specified encoding.
|
static String |
sha256(String string)
Returns an SHA256 hash in lower case.
|
static String[] |
split(String string,
char sep)
Splits a string around matches of the given separator.
|
static String[] |
split(String string,
char sep,
int limit)
Splits a string around matches of the given separator.
|
static boolean |
supported(String encoding)
Checks if the specified encoding is supported.
|
static int |
toInt(String string)
Converts the specified string into an integer value.
|
static long |
toLong(String string)
Converts the specified string into an long value.
|
static boolean |
yes(String string)
Checks if the specified string is "yes", "true", "on" or "1".
|
public static final String UTF8
public static final String UTF16
public static final String UTF16BE
public static final String UTF16LE
public static final String UTF32
public static long toLong(String string)
Long.MIN_VALUE
is returned if the input is invalid.string
- string to be convertedpublic static int toInt(String string)
Integer.MIN_VALUE
is returned if the input is invalid.string
- string to be convertedpublic static boolean eq(String str1, String str2)
null
.str1
- first stringstr2
- strings to be comparedpublic static boolean eq(String str, String... strings)
null
.str
- first stringstrings
- strings to be comparedpublic static boolean eqic(String str, String... strings)
str
- first stringstrings
- strings to be comparedpublic static String[] split(String string, char sep)
string
- string to be splitsep
- separation characterpublic static String[] split(String string, char sep, int limit)
string
- string to be splitsep
- separation characterlimit
- maximum number of strings (must be 1 or larger)public static String delete(String string, char ch)
string
- stringch
- character to be removedpublic static boolean contains(String string, char ch)
string
- stringch
- character to be foundpublic static String md5(String string)
string
- string to be hashedpublic static String sha256(String string)
string
- string to be hashedpublic static String camelCase(String string)
string
- string to convertpublic static String normEncoding(String encoding)
encoding
- input encoding (UTF-8 is returned for a null
reference)public static String normEncoding(String encoding, boolean utf16)
encoding
- input encoding (UTF-8 is returned for a null
reference)utf16
- normalize UTF-16 encodingpublic static boolean supported(String encoding)
encoding
- encodingpublic static boolean yes(String string)
string
- string to be checkedpublic static boolean no(String string)
string
- string to be checkedCopyright © 2005–2015 BaseX Team. All rights reserved.