Class StringHelper
- java.lang.Object
-
- de.fraunhofer.iosb.ilt.frostserver.util.StringHelper
-
public class StringHelper extends Object
- Author:
- jab
-
-
Field Summary
Fields Modifier and Type Field Description static net.time4j.format.expert.ChronoPrinter<net.time4j.range.MomentInterval>FORMAT_INTERVALstatic net.time4j.format.expert.ChronoPrinter<net.time4j.Moment>FORMAT_MOMENTstatic CharsetUTF8
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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 StringdeCapitalize(String string)static StringescapeForStringConstant(String in)Replaces all ' in the string with ''.static booleanisNullOrEmpty(String string)static StringurlDecode(String input)Decode the given input using UTF-8 as character set.static StringurlEncode(String input)static StringurlEncode(String string, boolean notSlashes)Urlencodes the given string, optionally not encoding forward slashes.static StringurlEncodeNotSlashes(String string)Urlencodes the given string, except for the forward slashes.
-
-
-
Field Detail
-
UTF8
public static final Charset 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 Detail
-
isNullOrEmpty
public static boolean isNullOrEmpty(String string)
-
cleanForLogging
public static String cleanForLogging(String string)
Replaces characters that might break logging output. Currently: \n, \r and \t- Parameters:
string- The string to clean.- Returns:
- The cleaned string.
-
cleanForLogging
public static String cleanForLogging(Object object)
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
public static String escapeForStringConstant(String in)
Replaces all ' in the string with ''.- Parameters:
in- The string to escape.- Returns:
- The escaped string.
-
urlDecode
public static String urlDecode(String input)
Decode the given input using UTF-8 as character set.- Parameters:
input- The input to urlDecode.- Returns:
- The decoded input.
-
urlEncode
public static String urlEncode(String string, boolean notSlashes)
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.
-
-