|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object pt.tumba.spell.StringUtils
public class StringUtils
A collection of String
handling utility methods.
Some of the methods available in this class have equivalents in the
java.lang.String
class. However, the implementations
provided here are a lot faster, since they do not deal with character
internationalization issues.
Field Summary | |
---|---|
private static StringUtils |
_theInstance
The single instance of this class. |
private static char[] |
specialChars
An array with all the valid accented characters. |
Constructor Summary | |
---|---|
private |
StringUtils()
Sole constructor, private because this is a Singleton class. |
Method Summary | |
---|---|
static java.lang.String |
capitalizate(java.lang.String str,
boolean accents)
Capitalizates a given String. |
static int |
count(java.lang.String str,
char c)
Counts the occurrence of the given char in a String. |
static StringUtils |
getInstance()
Return the single instance of this class. |
static char[] |
getSpecialChars()
Return an array with all the valid accented characters. |
static java.lang.String |
invertString(java.lang.String s)
Reverse a given String. |
static boolean |
isAccent(char chr)
Checks if a given character has diacritics. |
static boolean |
isAlphaNumeric(char c)
Tests whether a given character is alphabetic, numeric or the hyphen character. |
static boolean |
isCapitalizated(java.lang.String str)
Checks if a given String is capitalizated. |
static boolean |
isUpperCase(char chr)
Checks if a given character is uppercase. |
static boolean |
isVowel(java.lang.String in,
int at)
Checks if the character at a given position of a given string is a vowel. |
static boolean |
isVowel(java.lang.String in,
int at,
int length)
Checks if the character at a given position of a given string is a vowel The Y character is also considered. |
static int |
matchStrings(java.lang.String a,
java.lang.String b)
Matches two strings. |
static java.lang.String |
replace(java.lang.String source,
java.lang.String search,
java.lang.String replace)
Returns a new string resulting from replacing all occurrences of the String search in the String source, with the string replace. |
static char |
replaceAccent(char chr)
Replaces accented characters with their variations without the diacritics. |
static java.lang.String |
separateNumberWithDots(java.lang.String n)
Takes a numeric string and separates groups of 3 characters with a '.' character. |
static java.lang.String |
separateNumberWithDots(java.lang.String n,
int s)
Takes a numeric string and separates groups of "n" characters with a '.' character. |
static java.lang.String |
toLowerCase(java.lang.String str,
boolean accents)
Converts all of the characters in a given String to lower case. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final StringUtils _theInstance
private static char[] specialChars
Constructor Detail |
---|
private StringUtils()
Method Detail |
---|
public static boolean isAlphaNumeric(char c)
c
- The character to be tested.
public static int count(java.lang.String str, char c)
str
- The string to be tested.c
- the char to be counted.
public static int matchStrings(java.lang.String a, java.lang.String b)
a
- The first string.b
- The second string.
public static StringUtils getInstance()
StringUtils
.public static java.lang.String invertString(java.lang.String s)
s
- The String to reverse.
public static java.lang.String replace(java.lang.String source, java.lang.String search, java.lang.String replace)
source
- The original String.search
- The string to be replaces.replace
- The replacement String.
public static char replaceAccent(char chr)
chr
- the character to check.
public static boolean isAccent(char chr)
chr
- the char to check.
public static boolean isUpperCase(char chr)
chr
- the char to check.
public static java.lang.String separateNumberWithDots(java.lang.String n)
n
- A numeric String.
public static java.lang.String separateNumberWithDots(java.lang.String n, int s)
n
- A numeric String.s
- The number of characters to group.
public static java.lang.String toLowerCase(java.lang.String str, boolean accents)
str
- A String.accents
- if true, then besides converting the string to lower case
accented characters are also replaces with their versions without the diacritics.
public static char[] getSpecialChars()
public static final boolean isVowel(java.lang.String in, int at)
in
- A String.at
- The position in the String.
public static boolean isVowel(java.lang.String in, int at, int length)
in
- A String.at
- The position in the String.length
- The maximum lengh of the String to check.
public static boolean isCapitalizated(java.lang.String str)
str
- A String.
public static java.lang.String capitalizate(java.lang.String str, boolean accents)
str
- A String.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |