Package com.linkare.commons.utils
Class StringNormalizer
- java.lang.Object
-
- com.linkare.commons.utils.StringNormalizer
-
public final class StringNormalizer extends Object
Utility class providing some methods to normalize strings.- Since:
- 0.0.1
- Author:
- Paulo Zenida - Linkare TI
-
-
Constructor Summary
Constructors Modifier Constructor Description privateStringNormalizer()Hiding constructor so that this utility class cannot be instantiated from outside.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringcreateComputationalName(String string)static StringcreateComputationalName(String word, char separator)static Stringnormalize(String string)static voidnormalize(String[] words)It normalizes an array of words.private static Stringnormalize(String word, boolean toLowerCase)static StringnormalizeAndRemoveMinorChars(String word)static StringnormalizePreservingCapitalizedLetters(String word)
-
-
-
Method Detail
-
normalize
private static String normalize(String word, boolean toLowerCase)
- Parameters:
word- the word to be normalized.toLowerCase- the flag to control if thestringshould be converted to lower case (when true) or if the casing should be preserved (when false).- Returns:
- Returns the
wordnormalized in ASCII code.
-
normalize
public static String normalize(String string)
- Parameters:
string- the string to be normalized.- Returns:
- Returns the
stringin a normalized format, in all lower case. - See Also:
normalize(String, boolean)
-
normalizePreservingCapitalizedLetters
public static String normalizePreservingCapitalizedLetters(String word)
- Parameters:
word- the word to be normalized.- Returns:
- Returns the
stringin a normalized format, preserving the capital letters. - See Also:
normalize(String, boolean)
-
normalize
public static void normalize(String[] words)
It normalizes an array of words.- Parameters:
words- the list of words to be normalized.- See Also:
normalize(String)
-
normalizeAndRemoveMinorChars
public static String normalizeAndRemoveMinorChars(String word)
- Parameters:
word- the word to normalize.- Returns:
- Returns the
wordin a normalized format, without any lower case char.
-
createComputationalName
public static String createComputationalName(String string)
- Parameters:
string- the string to be computed.- Returns:
- Returns the computational name of the passed in
string. A computational name is the string without any empty spaces nor bars ('/'), which are both replaced with '-', and with no special characters like accents. E.g.,string result This is just one example this-is-just-one-example Centro de comunicação centro-de-comunicacao - See Also:
createComputationalName(String, char)
-
createComputationalName
public static String createComputationalName(String word, char separator)
- Parameters:
word-- Returns:
- Returns the computational name of the passed in
word. A computational name is the string without any empty spaces nor bars ('/'), which are both replaced with '-', and with no special characters like accents. E.g.,string result This is just one example this'separator'is'separator'just'separator'an'separator'example - See Also:
normalizeAndRemoveMinorChars(String)
-
-