Package com.jsql.util
Class StringUtil
java.lang.Object
com.jsql.util.StringUtil
Utility class adding String operations like join() which are not
part of standard JVM.
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
static String
static String
static String
static String
static String
static String
Adapter method for base64 decode.static String
Adapter method for base64 encode.static String
static String
Zip a string.static String
decimalHtmlEncode
(String text) Convert special characters like Chinese and Arabic letters to the corresponding html entities.static String
decimalHtmlEncode
(String text, boolean isRaw) static String
decompress
(String str) Unzip a String encoded from base64 or hexadecimal.static String
detectUtf8
(String text) static String
fromBase64Zip
(String text) static String
static String
fromHexZip
(String text) static String
static String
static String
Convert a hexadecimal String to String.static boolean
static String
removeSqlComment
(String query) Remove SQL comments except tamper /**\/ /*!...static String
toBase64Zip
(String text) static String
static String
static String
static String
-
Method Details
-
decimalHtmlEncode
Convert special characters like Chinese and Arabic letters to the corresponding html entities.- Parameters:
text
- string to encode- Returns:
- string encoded in html entities
-
decimalHtmlEncode
-
hexstr
Convert a hexadecimal String to String.- Parameters:
hex
- Hexadecimal String to convert- Returns:
- The string converted from hex
-
isUtf8
-
detectUtf8
-
base32Encode
-
base32Decode
-
base58Encode
-
base58Decode
-
base16Encode
-
base16Decode
-
base64Decode
Adapter method for base64 decode.- Parameters:
s
- base64 decode- Returns:
- Base64 decoded string
-
base64Encode
Adapter method for base64 encode.- Parameters:
s
- String to base64 encode- Returns:
- Base64 encoded string
-
compress
Zip a string.- Parameters:
str
- Text to zip- Returns:
- Zipped string
- Throws:
IOException
-
decompress
Unzip a String encoded from base64 or hexadecimal.- Parameters:
str
- String to unzip- Returns:
- String unzipped
- Throws:
IOException
-
toHex
-
fromHex
- Throws:
org.apache.commons.codec.DecoderException
-
toHexZip
- Throws:
IOException
-
fromHexZip
public static String fromHexZip(String text) throws IOException, org.apache.commons.codec.DecoderException - Throws:
IOException
org.apache.commons.codec.DecoderException
-
toBase64Zip
- Throws:
IOException
-
fromBase64Zip
- Throws:
IOException
-
toHtml
-
fromHtml
-
toUrl
-
fromUrl
-
cleanSql
-
removeSqlComment
Remove SQL comments except tamper /**\/ /*!...*\/ Negative lookahead: don't match tamper empty comment /**\/ or version comment /*!...*\/ JavaScript: (?!\/\*!.*\*\/|\/\*\*\/)\/\*.*\*\/
-