Package com.kheops.util
Class KStringUtil
java.lang.Object
com.kheops.util.KStringUtil
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
byteArray2Printable
(byte[] bytes) Convert a byte array into a printable format containing a String of hexadecimal digit characters (two per byte).static int
Counts how many times a substring appears in a String.static String
doubleChar
(String str, char c) static String
doubleChar2
(String str, char c) Deprecated.static String
encodeToHTML
(String value) Encoded all characters of the specified value that doesn't fit in any of these categories: [a-z] [A-Z] [0-9].static boolean
Checks if two strings are both null or equalstatic String
parseValue
(String str, String key, boolean caseSensitive, int startIndex) Parses a String a returns the value that was set for the specified keyword.
The value must be between curly brace characters.
Ex.:static String
static String
-
Method Details
-
doubleChar
-
doubleChar2
Deprecated.- See Also:
-
replace
-
replace
-
count
Counts how many times a substring appears in a String.- Parameters:
str
- the Stringvalue
- the substring to search- Returns:
- how many times a substring appears in a String.
-
parseValue
Parses a String a returns the value that was set for the specified keyword.
The value must be between curly brace characters.
Ex.:String value, s = "$param{$param1{value 1} $param2}"; value = KStringUtil.parseValue(s, "$param1", true, 0); // value should // equals "value 1"; value = KStringUtil.parseValue(s, "$param2", true, 0); // value should // equals null;
- Parameters:
str
- a String to parse.key
- a keyword.caseSensitive
- case-sensitive parsing.startIndex
- the index to begin to parse.- Returns:
- the value that was set for the specified keyword, null if no value was found.
-
encodeToHTML
Encoded all characters of the specified value that doesn't fit in any of these categories: [a-z] [A-Z] [0-9].- Parameters:
value
- the value to encode- Returns:
- the HTML encoded value
-
byteArray2Printable
Convert a byte array into a printable format containing a String of hexadecimal digit characters (two per byte).- Parameters:
bytes
- Byte array representation
-
equals
Checks if two strings are both null or equal- Returns:
- true if they are both null or equal
-