Class 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 Detail

      • StringNormalizer

        private StringNormalizer()
        Hiding constructor so that this utility class cannot be instantiated from outside.
    • Method Detail

      • normalize

        private static String normalize​(String word,
                                        boolean toLowerCase)
        Parameters:
        word - the word to be normalized.
        toLowerCase - the flag to control if the string should be converted to lower case (when true) or if the casing should be preserved (when false).
        Returns:
        Returns the word normalized in ASCII code.
      • normalize

        public static String normalize​(String string)
        Parameters:
        string - the string to be normalized.
        Returns:
        Returns the string in 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 string in 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 word in 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)