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.apache.myfaces.shared_orchestra.util
Class StringUtils

    java.lang.Object
      org.apache.myfaces.shared_orchestra.util.StringUtils

    public final class StringUtils

extends java.lang.Object

Implements utility functions for the String class

Emphasis on performance and reduced memory allocation/garbage collection in exchange for longer more complex code.

Version:
  $Revision: 472630 $ $Date: 2006-11-08 21:40:03 +0100 (Mi, 08 Nov 2006) $
Author:
  Anton Koinov (latest modification by $Author: grantsmith $)

Method Summary
`static java.lang.String` | `dequote(java.lang.String str, char quote)` Undoubles the quotes inside the string Example:
`static java.lang.String` | `dequote(java.lang.String str, int begin, int end, char quote)` Undoubles the quotes inside a substring Example:
`static java.lang.String` | `dequoteFull(java.lang.String str, char quote)` Removes the surrounding quote and any double quote inside the string Example:
`static java.lang.String` | `dequoteFull(java.lang.String str, int begin, int end, char quote)`
`static boolean` | `isFloatNoExponent(java.lang.String str)` Checks that the string represents a floating point number that CANNOT be in exponential notation
`static boolean` | `isFloatWithOptionalExponent(java.lang.String str)`
`static boolean` | `isInteger(java.lang.String str)`
`static boolean` | `isUnsignedInteger(java.lang.String str)`
`static int` | `minIndex(int a, int b)` Returns the minimum index >= 0, if any
`static java.lang.StringBuffer` | `replace(java.lang.StringBuffer out, java.lang.String s, java.lang.String repl, java.lang.String with)`
`static java.lang.String` | `replace(java.lang.String str, char repl, java.lang.String with)`
`static java.lang.String` | `replace(java.lang.String str, java.lang.String repl, java.lang.String with)`
`static java.lang.String[]` | `splitLongString(java.lang.String str, char separator)` Split a string into an array of strings arround a character separator.
`static java.lang.String[]` | `splitLongString(java.lang.String str, char separator, char quote)` Split a string into an array of strings arround a character separator.
`static java.lang.String[]` | `splitShortString(java.lang.String str, char separator)` Split a string into an array of strings arround a character separator.
`static java.lang.String[]` | `splitShortString(java.lang.String str, char separator, char quote)` Split a string into an array of strings arround a character separator.
`static java.lang.String` | `substring(java.lang.String str, int begin, int end)`
`static java.lang.String[]` | `trim(java.lang.String[] strings)`

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

Method Detail

### isFloatNoExponent

    public static boolean isFloatNoExponent(java.lang.String str)

  Checks that the string represents a floating point number that CANNOT be in exponential notation

  Parameters:
    `str` - the string to check
  Returns:
    boolean

### isFloatWithOptionalExponent

    public static boolean isFloatWithOptionalExponent(java.lang.String str)

### isInteger

    public static boolean isInteger(java.lang.String str)

### isUnsignedInteger

    public static boolean isUnsignedInteger(java.lang.String str)

### dequote

    public static java.lang.String dequote(java.lang.String str,
                                           char quote)

  Undoubles the quotes inside the string
  Example:

       hello""world becomes hello"world

  Parameters:
    `str` - input string to dequote
    `quote` - the quoting char
  Returns:
    dequoted string

### dequote

    public static java.lang.String dequote(java.lang.String str,
                                           int begin,
                                           int end,
                                           char quote)

  Undoubles the quotes inside a substring
  Example:

       hello""world becomes hello"world

  WARNING: scan for quote may continue to the end of the string, make sure that either `charAt(end + 1) == quote` or `end = str.lentgth()`. If in doubt call `dequote(str.substring(begin, end), quote)`

  Parameters:
    `str` - input string from which to get the substring, must not be null
    `begin` - begin index for substring
    `end` - end index for substring
    `quote` - the quoting char
  Returns:
    dequoted string
  Throws:
    `java.lang.IllegalArgumentException` - if string is incorrectly quoted

### dequoteFull

    public static java.lang.String dequoteFull(java.lang.String str,
                                               char quote)

  Removes the surrounding quote and any double quote inside the string
  Example:

       "hello""world" becomes hello"world

  Parameters:
    `str` - input string to dequote
    `quote` - the quoting char
  Returns:
    dequoted String

### dequoteFull

    public static java.lang.String dequoteFull(java.lang.String str,
                                               int begin,
                                               int end,
                                               char quote)

### replace

    public static java.lang.String replace(java.lang.String str,
                                           java.lang.String repl,
                                           java.lang.String with)

### replace

    public static java.lang.String replace(java.lang.String str,
                                           char repl,
                                           java.lang.String with)

### replace

    public static java.lang.StringBuffer replace(java.lang.StringBuffer out,
                                                 java.lang.String s,
                                                 java.lang.String repl,
                                                 java.lang.String with)

### splitLongString

    public static java.lang.String[] splitLongString(java.lang.String str,
                                                     char separator)

  Split a string into an array of strings arround a character separator. This function will be efficient for longer strings

  Parameters:
    `str` - the string to be split
    `separator` - the separator character
  Returns:
    array of string subparts

### splitLongString

    public static java.lang.String[] splitLongString(java.lang.String str,
                                                     char separator,
                                                     char quote)

  Split a string into an array of strings arround a character separator. Each element can be optionally quoted by the quote character.
  This function will be efficient for long strings

  Parameters:
    `str` - the string to be split
    `separator` - the separator character
    `quote` - the quote character
  Returns:
    array of string subparts
  Throws:
    `java.lang.IllegalArgumentException` - DOCUMENT ME!

### splitShortString

    public static java.lang.String[] splitShortString(java.lang.String str,
                                                      char separator)

  Split a string into an array of strings arround a character separator. This function will be efficient for short strings, for longer strings, another approach may be better

  Parameters:
    `str` - the string to be split
    `separator` - the separator character
  Returns:
    array of string subparts

### splitShortString

    public static java.lang.String[] splitShortString(java.lang.String str,
                                                      char separator,
                                                      char quote)

  Split a string into an array of strings arround a character separator. Each element can be optionally quoted by the quote character.
  This function will be efficient for short strings, for longer strings, another approach may be better

  Parameters:
    `str` - the string to be split
    `separator` - the separator character
    `quote` - the quote character
  Returns:
    array of string subparts
  Throws:
    `java.lang.IllegalArgumentException` - DOCUMENT ME!

### substring

    public static java.lang.String substring(java.lang.String str,
                                             int begin,
                                             int end)

### trim

    public static java.lang.String[] trim(java.lang.String[] strings)

### minIndex

    public static int minIndex(int a,
                               int b)

  Returns the minimum index >= 0, if any

  Use to find the first of two characters in a string:
  `minIndex(s.indexOf('/'), indexOf('\'))`

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 © 2009 The Apache Software Foundation. All Rights Reserved.