Class StringTransforms


  • public class StringTransforms
    extends Object
    • Constructor Detail

      • StringTransforms

        public StringTransforms()
    • Method Detail

      • dashedFromCamelCase

        public static String dashedFromCamelCase​(String val)
        "un"-capitalizes a string in lowerCamelCase or UpperCamelCase to all lowercase separated by dashes.
        Parameters:
        val - Value to un-capitalize
        Returns:
        Un-capitalized version
      • dottedFromCamelCase

        public static String dottedFromCamelCase​(String val)
        "un"-capitalizes a string in lowerCamelCase or UpperCamelCase to all lowercase separated by dots.
        Parameters:
        val - Value to un-capitalize
        Returns:
        Un-capitalized version
      • fromCamelCase

        public static String fromCamelCase​(String val,
                                           char separator)
        "un"-capitalizes a string in lowerCamelCase or UpperCamelCase to all lowercase separated by the provided separator.
        Parameters:
        val - Value to un-capitalize
        separator - Word separator
        Returns:
        Un-capitalized version
      • dashedFromSnakeCase

        public static String dashedFromSnakeCase​(String val)
        "un"-capitalizes a string in UPPER_SNAKE_CASE to all lowercase separated by dashes.
        Parameters:
        val - Value to un-capitalize
        Returns:
        Un-capitalized version
      • fromSnakeCase

        public static String fromSnakeCase​(String val,
                                           char separator)
        "un"-capitalizes a string in UPPER_SNAKE_CASE to all lowercase separated by the provided separator.
        Parameters:
        val - Value to un-capitalize
        separator - Word separator
        Returns:
        Un-capitalized version
      • toUpperSnakeCase

        public static String toUpperSnakeCase​(String val)
        Attempt to transform the given value into an "UPPER_SNAKE_CASE" version of the same string. Notably this replaces dots, dashes & spaces with underscores.
        Parameters:
        val - Value to transform
        Returns:
        UPPER_SNAKE_CASE version of string.
      • toUpperCamelCase

        public static String toUpperCamelCase​(String val)
        Attempt to transform the given value into an "UpperCamelCase" version of the same string. Notably this erases dots, dashes, underscores & spaces as it counts them as word breaks.
        Parameters:
        val - Value to transform
        Returns:
        UpperCamelCase version of string.
      • toLowerCamelCase

        public static String toLowerCamelCase​(String val)
        Attempt to transform the given value into a "lowerCamelCase" version of the same string. Notably this erases dots, dashes, underscores & spaces as it counts them as word breaks.
        Parameters:
        val - Value to transform
        Returns:
        lowerCamelCase version of the string.
      • capitalizeGroups

        public static String capitalizeGroups​(String val,
                                              boolean capitalizeFirstWord)
      • capitalize

        public static String capitalize​(String val)