Class StringHelper
java.lang.Object
de.fraunhofer.iosb.ilt.frostclient.utils.StringHelper
Various String helper methods.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final net.time4j.format.expert.ChronoPrinter<net.time4j.range.MomentInterval>static final net.time4j.format.expert.ChronoPrinter<net.time4j.Moment>static final Charset -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringcapitalize(String string) static StringcleanForLogging(Object object) Null-Save replaces characters that might break logging output.static StringcleanForLogging(String string) Replaces characters that might break logging output.static StringcleanForLogging(String string, int maxLength) Removes characters that might break logging output and truncates to a maximum length.Currently: \n, \r and \tstatic StringdeCapitalize(String string) static StringReplaces all ' in the string with ''.static booleanisNullOrEmpty(Object[] arr) static booleanisNullOrEmpty(String string) Returns true if the given string is null, or empty.static StringquoteForUrl(Object in) static StringDecode the given input using UTF-8 as character set.static Stringstatic StringUrlencodes the given string, optionally not encoding forward slashes.static StringurlEncodeNotSlashes(String string) Urlencodes the given string, except for the forward slashes.
-
Field Details
-
UTF8
-
FORMAT_MOMENT
public static final net.time4j.format.expert.ChronoPrinter<net.time4j.Moment> FORMAT_MOMENT -
FORMAT_INTERVAL
public static final net.time4j.format.expert.ChronoPrinter<net.time4j.range.MomentInterval> FORMAT_INTERVAL
-
-
Method Details
-
capitalize
-
deCapitalize
-
isNullOrEmpty
Returns true if the given string is null, or empty.- Parameters:
string- the string to check.- Returns:
- true if string == null || string.isEmpty()
-
isNullOrEmpty
-
cleanForLogging
Replaces characters that might break logging output. Currently: \n, \r and \t- Parameters:
string- The string to clean.- Returns:
- The cleaned string.
-
cleanForLogging
Null-Save replaces characters that might break logging output. Currently: \n, \r and \t- Parameters:
object- The Object to clean.- Returns:
- The cleaned string.
-
escapeForStringConstant
Replaces all ' in the string with ''.- Parameters:
in- The string to escape.- Returns:
- The escaped string.
-
cleanForLogging
Removes characters that might break logging output and truncates to a maximum length.Currently: \n, \r and \t- Parameters:
string- The string to clean.maxLength- The maximum length of the returned String.- Returns:
- The cleaned string.
-
quoteForUrl
-
urlEncode
Urlencodes the given string, optionally not encoding forward slashes. In urls, forward slashes before the "?" must never be urlEncoded. Urlencoding of slashes could otherwise be used to obfuscate phising URLs.- Parameters:
string- The string to urlEncode.notSlashes- If true, forward slashes are not encoded.- Returns:
- The urlEncoded string.
-
urlEncodeNotSlashes
Urlencodes the given string, except for the forward slashes.- Parameters:
string- The string to urlEncode.- Returns:
- The urlEncoded string.
-
urlEncode
-
urlDecode
Decode the given input using UTF-8 as character set.- Parameters:
input- The input to urlDecode.- Returns:
- The decoded input.
-