Package com.jsql.util

Class StringUtil

java.lang.Object
com.jsql.util.StringUtil

public final class StringUtil extends Object
Utility class adding String operations like join() which are not part of standard JVM.
  • Method Details

    • decimalHtmlEncode

      public static String decimalHtmlEncode(String text)
      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

      public static String decimalHtmlEncode(String text, boolean isRaw)
    • hexstr

      public static String hexstr(String hex)
      Convert a hexadecimal String to String.
      Parameters:
      hex - Hexadecimal String to convert
      Returns:
      The string converted from hex
    • isUtf8

      public static boolean isUtf8(String text)
    • detectUtf8

      public static String detectUtf8(String text)
    • base32Encode

      public static String base32Encode(String s)
    • base32Decode

      public static String base32Decode(String s)
    • base58Encode

      public static String base58Encode(String s)
    • base58Decode

      public static String base58Decode(String s)
    • base16Encode

      public static String base16Encode(String s)
    • base16Decode

      public static String base16Decode(String s)
    • base64Decode

      public static String base64Decode(String s)
      Adapter method for base64 decode.
      Parameters:
      s - base64 decode
      Returns:
      Base64 decoded string
    • base64Encode

      public static String base64Encode(String s)
      Adapter method for base64 encode.
      Parameters:
      s - String to base64 encode
      Returns:
      Base64 encoded string
    • compress

      public static String compress(String str) throws IOException
      Zip a string.
      Parameters:
      str - Text to zip
      Returns:
      Zipped string
      Throws:
      IOException
    • decompress

      public static String decompress(String str) throws IOException
      Unzip a String encoded from base64 or hexadecimal.
      Parameters:
      str - String to unzip
      Returns:
      String unzipped
      Throws:
      IOException
    • toHex

      public static String toHex(String text)
    • fromHex

      public static String fromHex(String text) throws org.apache.commons.codec.DecoderException
      Throws:
      org.apache.commons.codec.DecoderException
    • toHexZip

      public static String toHexZip(String text) throws IOException
      Throws:
      IOException
    • fromHexZip

      public static String fromHexZip(String text) throws IOException, org.apache.commons.codec.DecoderException
      Throws:
      IOException
      org.apache.commons.codec.DecoderException
    • toBase64Zip

      public static String toBase64Zip(String text) throws IOException
      Throws:
      IOException
    • fromBase64Zip

      public static String fromBase64Zip(String text) throws IOException
      Throws:
      IOException
    • toHtml

      public static String toHtml(String text)
    • fromHtml

      public static String fromHtml(String text)
    • toUrl

      public static String toUrl(String text)
    • fromUrl

      public static String fromUrl(String text)
    • cleanSql

      public static String cleanSql(String query)
    • removeSqlComment

      public static String removeSqlComment(String query)
      Remove SQL comments except tamper /**\/ /*!...*\/ Negative lookahead: don't match tamper empty comment /**\/ or version comment /*!...*\/ JavaScript: (?!\/\*!.*\*\/|\/\*\*\/)\/\*.*\*\/