org.cybergarage.util

## Class StringUtil

- java.lang.Object
- - org.cybergarage.util.StringUtil

-     public final class StringUtil
      extends Object

  Utility class for string manipulation and conversion operations. This class provides static methods for string validation, type conversion, character searching, and custom trimming operations.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `StringUtil()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static int` | `findFirstNotOf(String str, String chars)` Finds the first character that is NOT in the specified character set.
    `static int` | `findFirstOf(String str, String chars)` Finds the first occurrence of any character from the specified set.
    `static int` | `findLastNotOf(String str, String chars)` Finds the last character that is NOT in the specified character set.
    `static int` | `findLastOf(String str, String chars)` Finds the last occurrence of any character from the specified set.
    `static int` | `findOf(String str, String chars, int startIdx, int endIdx, int offset, boolean isEqual)` Generic character finding method with customizable search parameters.
    `static boolean` | `hasData(String value)` Checks if a string contains valid data (not null and not empty).
    `static int` | `toInteger(String value)` Converts a string to an integer value.
    `static long` | `toLong(String value)` Converts a string to a long value.
    `static String` | `trim(String trimStr, String trimChars)` Trims specified characters from both ends of a string.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### StringUtil

          public StringUtil()

  - ### Method Detail

    - #### findFirstNotOf

          public static final int findFirstNotOf(String str,
                                                 String chars)

      Finds the first character that is NOT in the specified character set.
      Parameters:
        `str` - string to search in
        `chars` - characters to exclude from search
      Returns:
        index of first non-matching character, or -1 if not found

    - #### findFirstOf

          public static final int findFirstOf(String str,
                                              String chars)

      Finds the first occurrence of any character from the specified set.
      Parameters:
        `str` - string to search in
        `chars` - characters to search for
      Returns:
        index of first matching character, or -1 if not found

    - #### findLastNotOf

          public static final int findLastNotOf(String str,
                                                String chars)

      Finds the last character that is NOT in the specified character set.
      Parameters:
        `str` - string to search in
        `chars` - characters to exclude from search
      Returns:
        index of last non-matching character, or -1 if not found

    - #### findLastOf

          public static final int findLastOf(String str,
                                             String chars)

      Finds the last occurrence of any character from the specified set.
      Parameters:
        `str` - string to search in
        `chars` - characters to search for
      Returns:
        index of last matching character, or -1 if not found

    - #### findOf

          public static final int findOf(String str,
                                         String chars,
                                         int startIdx,
                                         int endIdx,
                                         int offset,
                                         boolean isEqual)

      Generic character finding method with customizable search parameters.
      Parameters:
        `str` - the string to search in
        `chars` - the characters to search for
        `startIdx` - the starting index
        `endIdx` - the ending index
        `offset` - the search direction (1 for forward, -1 for backward)
        `isEqual` - true to find matching characters, false to find non-matching
      Returns:
        the index of the found character, or -1 if not found

    - #### hasData

          public static final boolean hasData(String value)

      Checks if a string contains valid data (not null and not empty).
      Parameters:
        `value` - the string to check
      Returns:
        true if the string is not null and has length > 0, false otherwise

    - #### toInteger

          public static final int toInteger(String value)

      Converts a string to an integer value.
      Parameters:
        `value` - the string to convert
      Returns:
        the integer value, or 0 if conversion fails

    - #### toLong

          public static final long toLong(String value)

      Converts a string to a long value.
      Parameters:
        `value` - the string to convert
      Returns:
        the long value, or 0 if conversion fails

    - #### trim

          public static final String trim(String trimStr,
                                          String trimChars)

      Trims specified characters from both ends of a string.
      Parameters:
        `trimStr` - string to trim
        `trimChars` - characters to remove from both ends
      Returns:
        trimmed string