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

## org.mortbay.util
Class StringUtil

    java.lang.Object
      org.mortbay.util.StringUtil

    public class StringUtil

extends Object

Fast String Utilities. These string utilities provide both conveniance methods and performance improvements over most standard library versions. The main aim of the optimizations is to avoid object creation unless absolutely required.

Author:
  Greg Wilkins (gregw)

Field Summary
`static String` | `__ISO_8859_1`
`static String` | `__LINE_SEPARATOR`
`static String` | `__UTF8`
`static String` | `CRLF`

Constructor Summary
`StringUtil()`

Method Summary
`static void` | `append(StringBuffer buf, byte b, int base)` append hex digit
`static void` | `append(StringBuffer buf, String s, int offset, int length)` Append substring to StringBuffer
`static void` | `append2digits(StringBuffer buf, int i)`
`static String` | `asciiToLowerCase(String s)` fast lower case conversion.
`static boolean` | `endsWithIgnoreCase(String s, String w)`
`static boolean` | `equals(String s, char[] buf, int offset, int length)`
`static int` | `indexFrom(String s, String chars)` returns the next index of a character from the chars string
`static boolean` | `isUTF8(String charset)`
`static String` | `nonNull(String s)` Return a non null string.
`static String` | `replace(String s, String sub, String with)` replace substrings within string.
`static boolean` | `startsWithIgnoreCase(String s, String w)`
`static String` | `toString(byte[] b, int offset, int length, String charset)`
`static String` | `toUTF8String(byte[] b, int offset, int length)`
`static String` | `unquote(String s)` Remove single or double quotes.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### CRLF

    public static final String CRLF

See Also:
  Constant Field Values

### __LINE_SEPARATOR

    public static final String __LINE_SEPARATOR

### __ISO_8859_1

    public static String __ISO_8859_1

### __UTF8

    public static final String __UTF8

See Also:
  Constant Field Values

Constructor Detail

### StringUtil

    public StringUtil()

Method Detail

### asciiToLowerCase

    public static String asciiToLowerCase(String s)

  fast lower case conversion. Only works on ascii (not unicode)

  Parameters:
    `s` - the string to convert
  Returns:
    a lower case version of s

### startsWithIgnoreCase

    public static boolean startsWithIgnoreCase(String s,
                                               String w)

### endsWithIgnoreCase

    public static boolean endsWithIgnoreCase(String s,
                                             String w)

### indexFrom

    public static int indexFrom(String s,
                                String chars)

  returns the next index of a character from the chars string

### replace

    public static String replace(String s,
                                 String sub,
                                 String with)

  replace substrings within string.

### unquote

    public static String unquote(String s)

  Remove single or double quotes.

### append

    public static void append(StringBuffer buf,
                              String s,
                              int offset,
                              int length)

  Append substring to StringBuffer

  Parameters:
    `buf` - StringBuffer to append to
    `s` - String to append from
    `offset` - The offset of the substring
    `length` - The length of the substring

### append

    public static void append(StringBuffer buf,
                              byte b,
                              int base)

  append hex digit

### append2digits

    public static void append2digits(StringBuffer buf,
                                     int i)

### nonNull

    public static String nonNull(String s)

  Return a non null string.

  Parameters:
    `s` - String
  Returns:
    The string passed in or empty string if it is null.

### equals

    public static boolean equals(String s,
                                 char[] buf,
                                 int offset,
                                 int length)

### toUTF8String

    public static String toUTF8String(byte[] b,
                                      int offset,
                                      int length)

### toString

    public static String toString(byte[] b,
                                  int offset,
                                  int length,
                                  String charset)

### isUTF8

    public static boolean isUTF8(String charset)

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

Copyright © 2007 Mort Bay Consulting. All Rights Reserved.