public class KStringUtil
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
byteArray2Printable(byte[] bytes)
Convert a byte array into a printable format containing a String of
hexadecimal digit characters (two per byte).
|
static int |
count(java.lang.String str,
java.lang.String value)
Counts how many times a substring appears in a String.
|
static java.lang.String |
doubleChar(java.lang.String str,
char c) |
static java.lang.String |
doubleChar2(java.lang.String str,
char c)
Deprecated.
|
static java.lang.String |
encodeToHTML(java.lang.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 |
equals(java.lang.String s1,
java.lang.String s2)
Checks if two strings are both null or equal
|
static java.lang.String |
parseValue(java.lang.String str,
java.lang.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 java.lang.String |
replace(java.lang.String str,
java.lang.String oldValue,
java.lang.String newValue) |
static java.lang.String |
replace(java.lang.String str,
java.lang.String oldValue,
java.lang.String newValue,
boolean ignoreCase) |
public static java.lang.String doubleChar(java.lang.String str, char c)
@Deprecated public static java.lang.String doubleChar2(java.lang.String str, char c)
doubleChar(String, char)
public static java.lang.String replace(java.lang.String str, java.lang.String oldValue, java.lang.String newValue)
public static java.lang.String replace(java.lang.String str, java.lang.String oldValue, java.lang.String newValue, boolean ignoreCase)
public static int count(java.lang.String str, java.lang.String value)
str
- the Stringvalue
- the substring to searchpublic static java.lang.String parseValue(java.lang.String str, java.lang.String key, boolean caseSensitive, int startIndex)
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;
str
- a String to parse.key
- a keyword.caseSensitive
- case-sensitive parsing.startIndex
- the index to begin to parse.public static java.lang.String encodeToHTML(java.lang.String value)
value
- the value to encodepublic static java.lang.String byteArray2Printable(byte[] bytes)
bytes
- Byte array representationpublic static boolean equals(java.lang.String s1, java.lang.String s2)