websphinx.util
Class Str

java.lang.Object
  |
  +--websphinx.util.Str

public abstract class Str
extends java.lang.Object

String utility routines.


Field Summary
private static int EXP
           
private static int FRAC
           
private static int INT
          Parse a number from a string.
 
Constructor Summary
Str()
           
 
Method Summary
static java.lang.String escape(java.lang.String subject, char escapeChar, java.lang.String metachars)
          Escapes metacharacters in a string.
static int indexOfAnyChar(java.lang.String subject, java.lang.String chars)
          Find first occurence of any of a set of characters.
static int indexOfAnyChar(java.lang.String subject, java.lang.String chars, int start)
          Find first occurence of any of a set of characters, starting at a specified index.
static void main(java.lang.String[] args)
           
static java.lang.Number parseNumber(java.lang.String s)
           
static java.lang.String replace(java.lang.String subject, java.lang.String original, java.lang.String replacement)
          Replace all occurences of a string.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

INT

private static final int INT
Parse a number from a string. Finds the first recognizable base-10 number (integer or floating point) in the string and returns it as a Number.

FRAC

private static final int FRAC

EXP

private static final int EXP
Constructor Detail

Str

public Str()
Method Detail

indexOfAnyChar

public static int indexOfAnyChar(java.lang.String subject,
                                 java.lang.String chars)
Find first occurence of any of a set of characters.
Parameters:
subject - String in which to search
chars - Characters to search for
Returns:
index of first occurence in subject of a character from chars, or -1 if no match.

indexOfAnyChar

public static int indexOfAnyChar(java.lang.String subject,
                                 java.lang.String chars,
                                 int start)
Find first occurence of any of a set of characters, starting at a specified index.
Parameters:
subject - String in which to search
chars - Characters to search for
start - Starting offset to search from
Returns:
index of first occurence (after start) in subject of a character from chars, or -1 if no match.

replace

public static java.lang.String replace(java.lang.String subject,
                                       java.lang.String original,
                                       java.lang.String replacement)
Replace all occurences of a string.
Parameters:
subject - String in which to search
original - String to search for in subject
replacement - String to substitute
Returns:
subject with all occurences of original replaced by replacement

escape

public static java.lang.String escape(java.lang.String subject,
                                      char escapeChar,
                                      java.lang.String metachars)
Escapes metacharacters in a string.
Parameters:
subject - String in which metacharacters are to be escaped
escapeChar - the escape character (e.g., \)
metachars - the metacharacters that should be escaped
Returns:
subject with escapeChar inserted before every character found in metachars

parseNumber

public static java.lang.Number parseNumber(java.lang.String s)
                                    throws java.lang.NumberFormatException

main

public static void main(java.lang.String[] args)