public final class StringUtil extends Object
Modifier and Type | Field and Description |
---|---|
static String |
LINE_SEPARATOR
Points to the System property 'line.separator'.
|
static Locale |
LOCALE_INTERNAL
LOCALE_INTERNAL is the default locale for string operations and number formatting.
|
static Charset |
UTF8_CHARSET
UTF-8 Charset
|
Modifier and Type | Method and Description |
---|---|
static String |
bytesToString(byte[] bytes)
Creates a UTF8_CHARSET string from a byte array.
|
static String |
bytesToString(byte[] bytes,
int offset,
int length)
Creates a UTF8_CHARSET string from a byte array.
|
static String |
getterIntoProperty(String getterName)
Convert getter into a property name
Example: 'getFoo' is converted into 'foo'
It's written defensively, when output is not a getter then it
return the original name.
|
static int |
indexOf(String input,
char ch)
Like a String.indexOf but without MIN_SUPPLEMENTARY_CODE_POINT handling
|
static int |
indexOf(String input,
char ch,
int offset)
Like a String.indexOf but without MIN_SUPPLEMENTARY_CODE_POINT handling
|
static boolean |
isNullOrEmpty(String s)
Checks if a string is empty or not.
|
static boolean |
isNullOrEmptyAfterTrim(String s)
Checks if a string is empty or not after trim operation
|
static int |
lastIndexOf(String input,
char ch)
Like a String.lastIndexOf but without MIN_SUPPLEMENTARY_CODE_POINT handling
|
static int |
lastIndexOf(String input,
char ch,
int offset)
Like a String.lastIndexOf but without MIN_SUPPLEMENTARY_CODE_POINT handling
|
static String |
lowerCaseInternal(String s)
HC specific settings, operands etc.
|
static byte[] |
stringToBytes(String s)
Creates a byte array from a string.
|
static String |
timeToString(long timeMillis)
Returns a String representation of the time.
|
static String |
timeToStringFriendly(long timeMillis)
Returns a String representation of the time.
|
static String[] |
tokenizeVersionString(String version)
Tokenizes a version string and returns the tokens with the following grouping:
(1) major version, eg "3"
(2) minor version, eg "8"
(3) patch version prefixed with ".", if exists, otherwise null (eg ".0")
(4) patch version, eg "0"
(5) 1st -qualifier, if exists
(6) -SNAPSHOT qualifier, if exists
|
static String |
upperCaseInternal(String s)
HC specific settings, operands etc.
|
public static final Charset UTF8_CHARSET
public static final String LINE_SEPARATOR
public static final Locale LOCALE_INTERNAL
java.util.Locale.US
(US English).public static String bytesToString(byte[] bytes, int offset, int length)
bytes
- the byte array.offset
- the index of the first byte to decodelength
- the number of bytes to decodepublic static String bytesToString(byte[] bytes)
bytes
- the byte array.public static byte[] stringToBytes(String s)
s
- the string.public static boolean isNullOrEmpty(String s)
s
- the string to check.public static boolean isNullOrEmptyAfterTrim(String s)
s
- the string to check.public static String upperCaseInternal(String s)
s
- the given stringpublic static String lowerCaseInternal(String s)
s
- the given stringpublic static String timeToString(long timeMillis)
This method is not particularly efficient since it generates a ton of litter.
timeMillis
- time in millispublic static String timeToStringFriendly(long timeMillis)
This method is not particularly efficient since it generates a ton of litter.
timeMillis
- time in millispublic static int indexOf(String input, char ch, int offset)
input
- to check the indexOf onch
- character to find the index ofoffset
- offset to start the reading frompublic static int indexOf(String input, char ch)
input
- to check the indexOf onch
- character to find the index ofpublic static int lastIndexOf(String input, char ch, int offset)
input
- to check the indexOf onch
- character to find the index ofoffset
- offset to start the reading from the endpublic static int lastIndexOf(String input, char ch)
input
- to check the indexOf onch
- character to find the index ofpublic static String[] tokenizeVersionString(String version)
version
- public static String getterIntoProperty(String getterName)
getterName
- Copyright © 2018 Hazelcast, Inc.. All Rights Reserved.