Xindice API
version 1.1b4

org.apache.xindice.util
Class StringUtilities

java.lang.Object
  |
  +--org.apache.xindice.util.StringUtilities

public final class StringUtilities
extends java.lang.Object

StringUtilities provides a set of commonly used String parsing and processing routines.

Version:
CVS $Revision: 1.7 $, $Date: 2004/02/08 02:59:39 $

Method Summary
static int findWhiteSpace(java.lang.String value)
          findWhiteSpace scans a String value for whitespace characters and returns the location of the first whitespace character found.
static int findWhiteSpace(java.lang.String value, int start)
          findWhiteSpace scans a String value for whitespace characters from a specified starting position and returns the location of the first whitespace character found.
static java.lang.String javaEncode(java.lang.String value)
          javaEncode converts a String value to a Java-printable String.
static java.lang.String leftJustify(java.lang.String value, int width)
          leftJustify left-justifies a String value, space padding to width characters if the string is less than width.
static java.lang.String rightJustify(java.lang.String value, int width)
          rightJustify right-justifies a String value, space padding to width characters if the string is less than width.
static int stringToInt(java.lang.String value)
          stringToInt quickly converts a String value to an int, returning 0 if a conversion error occurs.
static int stringToInt(java.lang.String value, int defvalue)
          stringToInt quickly converts a String value to an int, returning a default value if a conversion error occurs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

stringToInt

public static int stringToInt(java.lang.String value,
                              int defvalue)
stringToInt quickly converts a String value to an int, returning a default value if a conversion error occurs.
Parameters:
value - The value to convert
defvalue - The default value to return
Returns:
The converted value

stringToInt

public static int stringToInt(java.lang.String value)
stringToInt quickly converts a String value to an int, returning 0 if a conversion error occurs.
Parameters:
value - The value to convert
Returns:
The converted value

leftJustify

public static java.lang.String leftJustify(java.lang.String value,
                                           int width)
leftJustify left-justifies a String value, space padding to width characters if the string is less than width.
Parameters:
value - The value to left-justify
width - The width to left-justify to
Returns:
The left-justified value

rightJustify

public static java.lang.String rightJustify(java.lang.String value,
                                            int width)
rightJustify right-justifies a String value, space padding to width characters if the string is less than width.
Parameters:
value - The value to right-justify
width - The width to right-justify to
Returns:
The right-justified value

findWhiteSpace

public static int findWhiteSpace(java.lang.String value,
                                 int start)
findWhiteSpace scans a String value for whitespace characters from a specified starting position and returns the location of the first whitespace character found.
Parameters:
value - The value to scan
start - The starting position
Returns:
The first whitespace location

findWhiteSpace

public static int findWhiteSpace(java.lang.String value)
findWhiteSpace scans a String value for whitespace characters and returns the location of the first whitespace character found.
Parameters:
value - The value to scan
Returns:
The first whitespace location

javaEncode

public static java.lang.String javaEncode(java.lang.String value)
javaEncode converts a String value to a Java-printable String. All non-printable characters, such as newline and backspace are converted to their respective escape sequences. This method does not convert UNICODE characters.
Parameters:
value - The value to convert
Returns:
The converted value

Xindice API
version 1.1b4

Copyright (c) 1999-2004 The Apache Software Foundation. All Rights Reserved.