info.informatica.text
Class StringUtil

java.lang.Object
  extended by info.informatica.text.StringUtil

public final class StringUtil
extends Object

Convenience class for String utility functions

Version:
1.00, julio 1999
Author:
amengual at informatica dot info

Constructor Summary
StringUtil()
           
 
Method Summary
static String contractSpaces(String t)
          Contracts all the spaces of a given String, leaving only one space between characters
static String fillString(String s, char c, int n)
           
static String filterISOControl(String s)
          Removes all ISO control chars from a String
static String leftJustify(String s, char c, int n)
           
static String leftJustify(String s, char c, int n, char overchar)
           
static String omitAccents(String s)
          Removes accents for their corresponding vowels Handles upper & lower case, acutes, graves, umlates and circs.
static String replace(String s, String q, String pq)
          Replaces each 'q' for 'pq' on 's'.
static String replace(String s, String q, String pq, int n)
          Replaces each 'q' for 'pq' on 's'.
static String replaceISOControl(String s, char c)
          Replaces all ISO control chars in a String with char c
static String replaceLowerAccents(String s)
           
static String replaceNonChars(String s)
          Replace each character of 's' by a space if it's not a letter or digit
static String rightJustify(String s, char c, int n)
           
static String rightJustify(String s, char c, int n, char overchar)
           
static String toTitle(String s)
          Returns a title representation of the String (Spanish-style title, with only the first letter as Uppercase)
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringUtil

public StringUtil()
Method Detail

rightJustify

public static String rightJustify(String s,
                                  char c,
                                  int n)

rightJustify

public static String rightJustify(String s,
                                  char c,
                                  int n,
                                  char overchar)

leftJustify

public static String leftJustify(String s,
                                 char c,
                                 int n)

leftJustify

public static String leftJustify(String s,
                                 char c,
                                 int n,
                                 char overchar)

toTitle

public static String toTitle(String s)
Returns a title representation of the String (Spanish-style title, with only the first letter as Uppercase)


fillString

public static String fillString(String s,
                                char c,
                                int n)

contractSpaces

public static String contractSpaces(String t)
Contracts all the spaces of a given String, leaving only one space between characters


filterISOControl

public static String filterISOControl(String s)
Removes all ISO control chars from a String


replaceISOControl

public static String replaceISOControl(String s,
                                       char c)
Replaces all ISO control chars in a String with char c


replaceNonChars

public static final String replaceNonChars(String s)
Replace each character of 's' by a space if it's not a letter or digit


replaceLowerAccents

public static String replaceLowerAccents(String s)

replace

public static String replace(String s,
                             String q,
                             String pq)
Replaces each 'q' for 'pq' on 's'.

Parameters:
s - String to work on
q - subString to replace
pq - String that replaces q
Returns:
replaced 's'
See Also:
replace( String s, String q, String pq, int n )

replace

public static String replace(String s,
                             String q,
                             String pq,
                             int n)
Replaces each 'q' for 'pq' on 's'.

Parameters:
s - String to work on
q - subString to replace
pq - String that replaces q
n - times 'q' is contained by 's'
Returns:
replaced 's'

omitAccents

public static String omitAccents(String s)
Removes accents for their corresponding vowels Handles upper & lower case, acutes, graves, umlates and circs.

Parameters:
s - string to work on.
Returns:
's' unaccented.