Class KStringUtil

java.lang.Object
com.kheops.util.KStringUtil

public class KStringUtil extends Object
  • Method Details

    • doubleChar

      public static String doubleChar(String str, char c)
    • doubleChar2

      @Deprecated public static String doubleChar2(String str, char c)
      Deprecated.
      See Also:
    • replace

      public static String replace(String str, String oldValue, String newValue)
    • replace

      public static String replace(String str, String oldValue, String newValue, boolean ignoreCase)
    • count

      public static int count(String str, String value)
      Counts how many times a substring appears in a String.
      Parameters:
      str - the String
      value - the substring to search
      Returns:
      how many times a substring appears in a String.
    • parseValue

      public static 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.:
       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

      public 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].
      Parameters:
      value - the value to encode
      Returns:
      the HTML encoded value
    • byteArray2Printable

      public static String byteArray2Printable(byte[] bytes)
      Convert a byte array into a printable format containing a String of hexadecimal digit characters (two per byte).
      Parameters:
      bytes - Byte array representation
    • equals

      public static boolean equals(String s1, String s2)
      Checks if two strings are both null or equal
      Returns:
      true if they are both null or equal