Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.novell.nds.dirxml.util
Class StringUtil

    java.lang.Object
      com.novell.nds.dirxml.util.StringUtil

    public class StringUtil

extends Object

A class to hold various string processing utility functions

Constructor Summary
`StringUtil()`

Method Summary
`static byte[]` | `decodeAsciiHex(String encodedData)` Decode a string that represents binary data encoded in ASCII hex.
`static String` | `encodeAsciiHex(byte[] data)` Encode an array of bytes as an ASCII-hex string.
`static boolean` | `endsWithIgnoreCase(String string1, String string2)` Case insensitive version of startsWith
`static boolean` | `equalIgnoreCase(char c1, char c2)` Do a case insensitive comparison of characters for equality
`static Comparator` | `getCaseIgnoreComparator()`
`static Comparator` | `getNumericStringComparator()`
`static String` | `GUIDToString(byte[] binaryGUID)` Method to change from a binary GUID to canonical string representation.
`static int` | `indexOfIgnoreCase(String string, char ch)` Case insensitive version of indexOf
`static int` | `indexOfIgnoreCase(String string, char ch, int fromIndex)` Case insensitive version of indexOf
`static int` | `indexOfIgnoreCase(String string1, String string2)` Case insensitive version of indexOf
`static int` | `indexOfIgnoreCase(String string1, String string2, int fromIndex)` Case insensitive version of indexOf
`static String` | `join(String[] strings, String delimiter)` Join the elements of an array of `String`s into a single string separated by a delimiter string.
`static boolean` | `startsWithIgnoreCase(String string1, String string2)` Case insensitive version of startsWith
`static byte[]` | `stringToGUID(String stringGUID)` Method to change from a binary GUID to canonical string representation.
`static String` | `substring(String string, int start, int length)` A different kind of substring the that provided by java.lang.String
`static String` | `substringAfter(String string1, String string2)` Get the substring that consists of the sequence characters in string1 that occur after the string2 in string1
`static String` | `substringAfterIgnoreCase(String string1, String string2)` Get the substring that consists of the sequence characters in string1 that occur after the string2 in string1 (ignoring case)
`static String` | `substringBefore(String string1, String string2)` Get the substring that consists of the sequence characters in string1 that occur before the string2 in string1
`static String` | `substringBeforeIgnoreCase(String string1, String string2)` Get the substring that consists of the sequence characters in string1 that occur before the string2 in string1 (ignoring case)
`static String` | `toLowerCaseChars(String string)` Convert all the characters in a string to lower case.
`static String` | `toUpperCaseChars(String string)` Convert all the characters in a string to upper case.

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

### toUpperCaseChars

    public static String toUpperCaseChars(String string)

  Convert all the characters in a string to upper case. Note that this is different than String.toUpperCase() in that it uses Unicode rules to convert each character in a vacuum rather than using Locale specific rules that may consider context.

  Parameters:
    `string` - the string to convert
  Returns:
    the converted string

### toLowerCaseChars

    public static String toLowerCaseChars(String string)

  Convert all the characters in a string to lower case. Note that this is different than String.toLowerCase() in that it uses Unicode rules to convert each character in a vacuum rather than using Locale specific rules that may consider context.

  Parameters:
    `string` - the string to convert
  Returns:
    the converted string

### equalIgnoreCase

    public static boolean equalIgnoreCase(char c1,
                                          char c2)

  Do a case insensitive comparison of characters for equality

  Parameters:
    `c1` - the first character
    `c2` - the second character
  Returns:
    true if the characters are equal ignoring case

### indexOfIgnoreCase

    public static int indexOfIgnoreCase(String string,
                                        char ch)

  Case insensitive version of indexOf

  Parameters:
    `string` - a string.
    `ch` - a character.
  Returns:
    the index of the first occurrence of the character in the string (ignoring case), or `-1` if the character does not occur.

### indexOfIgnoreCase

    public static int indexOfIgnoreCase(String string,
                                        char ch,
                                        int fromIndex)

  Case insensitive version of indexOf

  Parameters:
    `string` - a string.
    `ch` - a character.
    `fromIndex` - the index to start the search from.
  Returns:
    the index of the first occurrence of the character in the string (ignoring case) that is greater than or equal to fromIndex, or `-1` if the character does not occur.

### indexOfIgnoreCase

    public static int indexOfIgnoreCase(String string1,
                                        String string2)

  Case insensitive version of indexOf

  Parameters:
    `string1` - a string.
    `string2` - a string.
  Returns:
    if the string2 argument occurs as a substring within the string object, then the index of the first character of the first such substring is returned; if it does not occur as a substring, `-1` is returned.

### indexOfIgnoreCase

    public static int indexOfIgnoreCase(String string1,
                                        String string2,
                                        int fromIndex)

  Case insensitive version of indexOf

  Parameters:
    `string1` - a string.
    `string2` - a string.
    `fromIndex` - the index from which to start the search.
  Returns:
    if the string2 argument occurs as a substring within the string object after the fromIndex, then the index of the first character of the first such substring is returned; if it does not occur as a substring, `-1` is returned.

### startsWithIgnoreCase

    public static boolean startsWithIgnoreCase(String string1,
                                               String string2)

  Case insensitive version of startsWith

  Parameters:
    `string1` - a string.
    `string2` - a string.
  Returns:
    true if the string1 argument starts with the string2 argument (ignoring case)

### endsWithIgnoreCase

    public static boolean endsWithIgnoreCase(String string1,
                                             String string2)

  Case insensitive version of startsWith

  Parameters:
    `string1` - a string.
    `string2` - a string.
  Returns:
    true if the string1 argument starts with the string2 argument (ignoring case)

### substring

    public static String substring(String string,
                                   int start,
                                   int length)

  A different kind of substring the that provided by java.lang.String

  Parameters:
    `string` - a string.
    `start` - the starting index of the substring; if negative then it becomes string.length() + index; if still negative then 0 is used
    `length` - the length of the string to get; if greater than what is available, only what is available is gotten if negative then it is length of string + 1 + length, or 0 whichever is greater
  Returns:
    the substring

### substringBefore

    public static String substringBefore(String string1,
                                         String string2)

  Get the substring that consists of the sequence characters in string1 that occur before the string2 in string1

  Parameters:
    `string1` - a string
    `string2` - a string
  Returns:
    a that consists of the sequence characters in string1 that occur before the string2 in string1, or the empty string if string2 does not occur in string1

### substringBeforeIgnoreCase

    public static String substringBeforeIgnoreCase(String string1,
                                                   String string2)

  Get the substring that consists of the sequence characters in string1 that occur before the string2 in string1 (ignoring case)

  Parameters:
    `string1` - a string
    `string2` - a string
  Returns:
    a that consists of the sequence characters in string1 that occur before the string2 in string1(ignoring case), or the empty string if string2 does not occur in string1

### substringAfter

    public static String substringAfter(String string1,
                                        String string2)

  Get the substring that consists of the sequence characters in string1 that occur after the string2 in string1

  Parameters:
    `string1` - a string
    `string2` - a string
  Returns:
    a that consists of the sequence characters in string1 that occur after the string2 in string1, or the empty string if string2 does not occur in string1

### substringAfterIgnoreCase

    public static String substringAfterIgnoreCase(String string1,
                                                  String string2)

  Get the substring that consists of the sequence characters in string1 that occur after the string2 in string1 (ignoring case)

  Parameters:
    `string1` - a string
    `string2` - a string
  Returns:
    a that consists of the sequence characters in string1 that occur after the string2 in string1(ignoring case), or the empty string if string2 does not occur in string1

### getCaseIgnoreComparator

    public static Comparator getCaseIgnoreComparator()

### getNumericStringComparator

    public static Comparator getNumericStringComparator()

### GUIDToString

    public static String GUIDToString(byte[] binaryGUID)

  Method to change from a binary GUID to canonical string representation.

  We do this so that the association value is more human-readable as it appears in the directory.

  Parameters:
    `binaryGUID` - The binary GUID
  Returns:
    The canonical string representation

### stringToGUID

    public static byte[] stringToGUID(String stringGUID)

  Method to change from a binary GUID to canonical string representation.

  We do this so that the association value is more human-readable as it appears in the directory.

  Parameters:
    `stringGUID` - The string GUID
  Returns:
    binary GUID

### decodeAsciiHex

    public static byte[] decodeAsciiHex(String encodedData)

  Decode a string that represents binary data encoded in ASCII hex. This expects capital letters only.

  Parameters:
    `encodedData` - The encoded data string
  Returns:
    An array of bytes containing the decoded data

### encodeAsciiHex

    public static String encodeAsciiHex(byte[] data)

  Encode an array of bytes as an ASCII-hex string. This encodes using capital letters only.

  Parameters:
    `data` - The data to be encoded.
  Returns:
    The encoded data string

### join

    public static String join(String[] strings,
                              String delimiter)

  Join the elements of an array of `String`s into a single string separated by a delimiter string.

  Parameters:
    `strings` - an array of strings
    `delimiter` - the delimiter string
  Returns:
    the joined string

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD