Class StringProcessor


  • public class StringProcessor
    extends Object
    * @author Divine Divine
    • Constructor Detail

      • StringProcessor

        public StringProcessor()
    • Method Detail

      • insertSpaceBetweenPascalCase

        public static String insertSpaceBetweenPascalCase​(String input)
      • removeDoubleWhiteSpaces

        public static String removeDoubleWhiteSpaces​(String input)
      • removeWhiteSpaces

        public static String removeWhiteSpaces​(String input)
        Remove all white spaces (spaces, tabs, ...) from the input string.
        Parameters:
        input - the string from which white spaces are removed.
        Returns:
        the input with removed white spaces
      • formatHumanReadable

        public static String formatHumanReadable​(String input)
      • transformUpperCaseToPascalCase

        public static String transformUpperCaseToPascalCase​(String input)
      • transformToPascalCase

        public static String transformToPascalCase​(String input)
      • transformToCamelCase

        public static String transformToCamelCase​(String input)
      • transformToKebabCase

        public static String transformToKebabCase​(String input)
      • replaceHyphenWithUnderscore

        public static String replaceHyphenWithUnderscore​(String input)
      • transformToUpperCase

        public static String transformToUpperCase​(String input)
      • transformFirstCharToUpperCase

        public static String transformFirstCharToUpperCase​(String input)
      • transformFirstCharToLowerCase

        public static String transformFirstCharToLowerCase​(String input)
      • fillWithSpaces

        public static String fillWithSpaces​(String input,
                                            int lenght)
        Method fills the given input string with width-spaces until the given string length is reached.

        Note: The origin input string will aligned to the left.

        Parameters:
        input - the original input string
        lenght - the requested input string length.
        Returns:
        the extended input string
      • fillWithSpaces

        public static String fillWithSpaces​(String input,
                                            int lenght,
                                            StringProcessor.Alignment textAlignment)
        Method fills the given input string with width-spaces until the given string length is reached.

        Note: The origin input string will aligned to the left.

        Parameters:
        input - the original input string
        lenght - the requested input string length.
        textAlignment - the alignment of the origin input string.
        Returns:
        the extended input string
      • transformToIdString

        public static String transformToIdString​(String input)
      • transformToNormalizedFileName

        public static String transformToNormalizedFileName​(String filename)
        Method normalizes a string into a simple file name by removing duplicated path limiters.
        Parameters:
        filename - the file name origin
        Returns:
        the normalized file name.
      • transformCollectionToString

        public static <ENTRY> String transformCollectionToString​(Collection<ENTRY> collection,
                                                                 String separator,
                                                                 Filter<ENTRY>... filters)
        Method calls toString on each entry of the given collection and builds a string where each entry is separated by the given separator.
        Parameters:
        collection - the collection to repesent as string.
        separator - the separator between each entry.
        filters - a set of filters to skip specific entries.
        Returns:
        the string representation of the collection.
      • transformCollectionToString

        public static <ENTRY> String transformCollectionToString​(Collection<ENTRY> collection,
                                                                 org.openbase.jul.iface.Transformer<ENTRY,​String> transformer,
                                                                 String separator,
                                                                 Filter<ENTRY>... filters)
        Method calls toString on each entry of the given collection and builds a string where each entry is separated by the given separator.
        Parameters:
        collection - the collection providing entries to print.
        transformer - provides a transformation from an entry to the string representation.
        separator - the separator between each entry to use.
        filters - a set of filters to skip specific entries.
        Returns:
        the string representation of the collection.