ZetaGrid v1.9

zeta.util
Class StringUtils

java.lang.Object
  |
  +--zeta.util.StringUtils

public class StringUtils
extends java.lang.Object

Provides string utilities.


Constructor Summary
StringUtils()
           
 
Method Summary
static java.lang.String format(boolean left, char fill, int size, java.lang.String text)
          Returns a formatted string.
static void format(boolean left, char fill, int size, java.lang.String text, java.lang.StringBuffer buffer)
          Formats a specified string and appends the formatted string to the buffer.
static int indexOfIgnoreCase(java.lang.String string, java.lang.String substring, int fromIndex)
          Returns the index within the specified string of the first occurrence of the specified substring ignoring case considerations and starting at the specified index.
static int numberOfDigits(java.lang.String text)
          Counts the number of digits in the specified text.
static java.lang.String replace(java.lang.String text, java.lang.String oldCharacters, java.lang.String newCharacters)
          Replaces indicated characters with other characters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringUtils

public StringUtils()
Method Detail

format

public static java.lang.String format(boolean left,
                                      char fill,
                                      int size,
                                      java.lang.String text)
Returns a formatted string.

Parameters:
left - true means left alignment otherwise rigth alignment
fill - filling character if the specified text is smaller than the resulting size
size - size of the formatted string
text - string which should be formated
Returns:
formatted string

format

public static void format(boolean left,
                          char fill,
                          int size,
                          java.lang.String text,
                          java.lang.StringBuffer buffer)
Formats a specified string and appends the formatted string to the buffer.

Parameters:
left - true means left alignment otherwise rigth alignment
fill - filling character if the specified text is smaller than the resulting size
size - size of the formatted string
text - string which should be formated
buffer - buffer where the formatted string will be appended

replace

public static java.lang.String replace(java.lang.String text,
                                       java.lang.String oldCharacters,
                                       java.lang.String newCharacters)
Replaces indicated characters with other characters.

Parameters:
text - string where characters should be replaced
oldCharacters - the character to be replaced by newCharacters.
newCharacters - the character replacing oldCharacters.
Returns:
replaced string.

numberOfDigits

public static int numberOfDigits(java.lang.String text)
Counts the number of digits in the specified text.

Parameters:
text - string
Returns:
number of digits in the specified text.

indexOfIgnoreCase

public static int indexOfIgnoreCase(java.lang.String string,
                                    java.lang.String substring,
                                    int fromIndex)
Returns the index within the specified string of the first occurrence of the specified substring ignoring case considerations and starting at the specified index. The integer returned is the smallest value k such that:
  string.startsWith(substring, k)
  
is true.

Parameters:
string - any string.
substring - any string.
fromIndex - the index from which to start the search.
Returns:
if the second string argument occurs as a substring within the first string argument, then the index of the first character of the first such substring is returned; if it does not occur as a substring, -1 is returned.
Throws:
java.lang.NullPointerException - if string or substring is null.

ZetaGrid v1.9

For further technical papers, see ZetaGrid Technical Documentation.
 
Copyright © 2001,2002 Sebastian Wedeniwski. All Rights Reserved.