public final class Strings extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
containsAny(CharSequence cs,
char... searchChars)
Checks if the CharSequence contains any character in the given set of characters.
|
static boolean |
containsAny(CharSequence cs,
CharSequence searchChars)
Checks if the CharSequence contains any character in the given set of characters.
|
static int |
countMatches(CharSequence str,
CharSequence sub)
Counts how many times the substring appears in the larger string.
|
static boolean |
equalsAny(CharSequence cs,
CharSequence first,
CharSequence... rest) |
static String |
hexToString(String hex)
Hex to string
|
static boolean |
isEmpty(CharSequence cs)
Checks if a CharSequence is empty ("") or null.
|
static String |
of(byte[] bytes)
Try to decode the bytes as UTF-8 string, and converted to HEX string if the bytes cannot be decoded, which
probably means the bytes are binary data
|
static String |
toHex(byte[] bytes)
Bytes to hex
|
static String |
toHex(String str)
String to hex
|
static String |
toHex(String str,
Charset charset) |
static byte[] |
toUFT8(String s)
String to bytes
|
public static String of(byte[] bytes)
bytes
- public static String toHex(byte[] bytes)
bytes
- public static byte[] toUFT8(String s)
s
- public static boolean equalsAny(CharSequence cs, CharSequence first, CharSequence... rest)
cs
- first
- rest
- public static boolean containsAny(CharSequence cs, CharSequence searchChars)
cs
- the CharSequence to check, may be nullsearchChars
- the chars to search for, may be nulltrue
if any of the chars are found, false
if no match or null inputpublic static boolean containsAny(CharSequence cs, char... searchChars)
cs
- the CharSequence to check, may be nullsearchChars
- the chars to search for, may be nulltrue
if any of the chars are found, false
if no match or null inputpublic static boolean isEmpty(CharSequence cs)
cs
- the CharSequence to check, may be nulltrue
if the CharSequence is empty or nullpublic static int countMatches(CharSequence str, CharSequence sub)
str
- the CharSequence to check, may be nullsub
- the substring to count, may be nullnull
Copyright © 2018 Eclipse Paho. All rights reserved.