Xindice API
version 1.2m1

org.apache.xindice.util
Class StringUtilities

java.lang.Object
  extended byorg.apache.xindice.util.StringUtilities

public final class StringUtilities
extends Object

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

Version:
$Revision: 541508 $, $Date: 2007-05-24 21:54:12 -0400 (Thu, 24 May 2007) $

Method Summary
static boolean equals(String s1, String s2)
           
static String escapeXml(String text)
          Converts input text into its XML representation by escaping all special symbols, if any are present.
static int findWhiteSpace(String value)
          findWhiteSpace scans a String value for whitespace characters and returns the location of the first whitespace character found.
static int findWhiteSpace(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 boolean isBlank(String str)
           
static String javaEncode(String value)
          javaEncode converts a String value to a Java-printable String.
static String leftJustify(String value, int width)
          leftJustify left-justifies a String value, space padding to width characters if the string is less than width.
static String rightJustify(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(String value)
          stringToInt quickly converts a String value to an int, returning 0 if a conversion error occurs.
static int stringToInt(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(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(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 String leftJustify(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 String rightJustify(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(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(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 String javaEncode(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

equals

public static boolean equals(String s1,
                             String s2)

escapeXml

public static String escapeXml(String text)
Converts input text into its XML representation by escaping all special symbols, if any are present.

Parameters:
text - Input string
Returns:
String with all the special symbols escaped

isBlank

public static boolean isBlank(String str)

Xindice API
version 1.2m1

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