Class CaseConverterUtils

java.lang.Object
software.bluelib.utils.conversion.CaseConverterUtils

public class CaseConverterUtils extends Object
A public class for converting strings between various naming conventions: camelCase, PascalCase, snake_case, kebab-case, UPPER_SNAKE_CASE, Train-Case, flatcase, and COBOL-CASE.

Key Methods:

Since:
1.0.0
  • Method Details

    • toCamelCase

      public static String toCamelCase(String pInput)
      A String that converts a given String to camelCase.

      If the input is in PascalCase, snake_case, or kebab-case, it will be converted accordingly.

      Parameters:
      pInput - String - The input string to be converted.
      Returns:
      The camelCase version of the input string.
      Since:
      1.0.0
    • toPascalCase

      public static String toPascalCase(String pInput)
      A String that converts a given String to PascalCase.

      If the input is in camelCase, snake_case, or kebab-case, it will be converted accordingly.

      Parameters:
      pInput - String - The input string to be converted.
      Returns:
      The PascalCase version of the input string.
      Since:
      1.0.0
    • toSnakeCase

      public static String toSnakeCase(String pInput)
      A String that converts a given String to snake_case.

      It converts camelCase, PascalCase, and kebab-case to snake_case by adding underscores where appropriate.

      Parameters:
      pInput - String - The input string to be converted.
      Returns:
      The snake_case version of the input string.
      Since:
      1.0.0
    • toKebabCase

      public static String toKebabCase(String pInput)
      A String that converts a given String to kebab-case.

      It converts camelCase, PascalCase, and snake_case to kebab-case by adding hyphens where appropriate.

      Parameters:
      pInput - String - The input string to be converted.
      Returns:
      The kebab-case version of the input string.
      Since:
      1.0.0
    • toUpperSnakeCase

      public static String toUpperSnakeCase(String pInput)
      A String that converts a given String to UPPER_SNAKE_CASE.

      Converts camelCase, PascalCase, snake_case, and kebab-case to UPPER_SNAKE_CASE by adding underscores and converting all letters to uppercase.

      Parameters:
      pInput - String - The input string to be converted.
      Returns:
      The UPPER_SNAKE_CASE version of the input string.
      Since:
      1.0.0
    • toTrainCase

      public static String toTrainCase(String pInput)
      A String that converts a given String to Train-Case.

      Converts camelCase, PascalCase, snake_case, and kebab-case to Train-Case by adding hyphens and capitalizing each word.

      Parameters:
      pInput - String - The input string to be converted.
      Returns:
      The Train-Case version of the input string.
      Since:
      1.0.0
    • toFlatcase

      public static String toFlatcase(String pInput)
      A String that converts a given String to flatcase.

      Converts all cases to flatcase by removing any delimiters and converting to lowercase.

      Parameters:
      pInput - String - The input string to be converted.
      Returns:
      The flatcase version of the input string.
      Since:
      1.0.0
    • toCobolCase

      public static String toCobolCase(String pInput)
      A String that converts a given String to COBOL-CASE.

      Converts camelCase, PascalCase, snake_case, and kebab-case to COBOL-CASE by making all letters uppercase and replacing spaces with hyphens.

      Parameters:
      pInput - String - The input string to be converted.
      Returns:
      The COBOL-CASE version of the input string.
      Since:
      1.0.0