Class StringCase

java.lang.Object
com.github.sttk.stringcase.StringCase

public final class StringCase extends Object
Is the class that provides the static methods to convert a string to following cases. - camelCase - COBOL-CASE - kebab-case - MACRO_CASE - PascalCase - snake_case - Train-Case
  • Method Details

    • camelCaseWithOptions

      public static String camelCaseWithOptions(String input, Options opts)
      Converts the input string to camel case with the specified options.
      Parameters:
      input - The input string.
      opts - The options which specifies the ways of case conversion.
      Returns:
      A string converted to camel case.
    • camelCase

      public static String camelCase(String input)
      Converts the input string to camel case.

      It treats the end of a sequence of non-alphabetical characters as a word boundary, but not the beginning.

      Parameters:
      input - The input string.
      Returns:
      A string converted to camel case.
    • camelCaseWithSep

      @Deprecated public static String camelCaseWithSep(String input, String seps)
      Converts the input string to camel case with the specified separator characters.
      Parameters:
      input - The input string.
      seps - The symbol characters to be treated as separators.
      Returns:
      A string converted to camel case.
    • camelCaseWithKeep

      @Deprecated public static String camelCaseWithKeep(String input, String kept)
      Converts the input string to camel case with the specified characters to be kept.
      Parameters:
      input - The input string.
      kept - The symbol characters not to be treated as separators.
      Returns:
      A string converted to camel case.
    • cobolCaseWithOptions

      public static String cobolCaseWithOptions(String input, Options opts)
      Converts the input string to cobol case with the specified options.
      Parameters:
      input - The input string.
      opts - The options with specifies the ways of case conversion.
      Returns:
      A string converted to cobol case.
    • cobolCase

      public static String cobolCase(String input)
      Converts the input string to cobol case.

      It treats the end of a sequence of non-alphabetical characters as a word boundary, but not the beginning.

      Parameters:
      input - The input string.
      Returns:
      A string converted to cobol case.
    • cobolCaseWithSep

      @Deprecated public static String cobolCaseWithSep(String input, String seps)
      Converts the input string to cobol case with the specified separator characters.
      Parameters:
      input - The input string.
      seps - The symbol characters to be treated as separators.
      Returns:
      A string converted to cobol case.
    • cobolCaseWithKeep

      @Deprecated public static String cobolCaseWithKeep(String input, String kept)
      Converts the input string to cobol case with the specified characters to be kept.
      Parameters:
      input - The input string.
      kept - The symbol characters not to be treated as separators.
      Returns:
      A string converted to cobol case.
    • kebabCaseWithOptions

      public static String kebabCaseWithOptions(String input, Options opts)
      Converts the input string to kebab case with the specified options.
      Parameters:
      input - The input string.
      opts - The options with specifies the ways of case conversion.
      Returns:
      A string converted to kebab case.
    • kebabCase

      public static String kebabCase(String input)
      Converts the input string to kebab case.

      It treats the end of a sequence of non-alphabetical characters as a word boundary, but not the beginning.

      Parameters:
      input - The input string.
      Returns:
      A string converted to kebab case.
    • kebabCaseWithSep

      @Deprecated public static String kebabCaseWithSep(String input, String seps)
      Converts the input string to kebab case with the specified separator characters.
      Parameters:
      input - The input string.
      seps - The symbol characters to be treated as separators.
      Returns:
      A string converted to kebab case.
    • kebabCaseWithKeep

      @Deprecated public static String kebabCaseWithKeep(String input, String kept)
      Converts the input string to kebab case with the specified characters to be kept.
      Parameters:
      input - The input string.
      kept - The symbol characters not to be treated as separators.
      Returns:
      A string converted to kebab case.
    • macroCaseWithOptions

      public static String macroCaseWithOptions(String input, Options opts)
      Converts the input string to macro case with the specified options.
      Parameters:
      input - The input string.
      opts - The options with specifies the ways of case conversion.
      Returns:
      A string converted to macro case.
    • macroCase

      public static String macroCase(String input)
      Converts the input string to macro case.

      It treats the end of a sequence of non-alphabetical characters as a word boundary, but not the beginning.

      Parameters:
      input - The input string.
      Returns:
      A string converted to macro case.
    • macroCaseWithSep

      @Deprecated public static String macroCaseWithSep(String input, String seps)
      Converts the input string to macro case with the specified separator characters.
      Parameters:
      input - The input string.
      seps - The symbol characters to be treated as separators.
      Returns:
      A string converted to macro case.
    • macroCaseWithKeep

      @Deprecated public static String macroCaseWithKeep(String input, String kept)
      Converts the input string to macro case with the specified characters to be kept.
      Parameters:
      input - The input string.
      kept - The symbol characters not to be treated as separators.
      Returns:
      A string converted to macro case.
    • pascalCaseWithOptions

      public static String pascalCaseWithOptions(String input, Options opts)
      Converts the input string to pascal case with the specified options.
      Parameters:
      input - The input string.
      opts - The options which specifies the ways of case conversion.
      Returns:
      A string converted to pascal case.
    • pascalCase

      public static String pascalCase(String input)
      Converts the input string to pascal case.

      It treats the end of a sequence of non-alphabetical characters as a word boundary, but not the beginning.

      Parameters:
      input - The input string.
      Returns:
      A string converted to pascal case.
    • pascalCaseWithSep

      @Deprecated public static String pascalCaseWithSep(String input, String seps)
      Converts the input string to pascal case with the specified separator characters.
      Parameters:
      input - The input string.
      seps - The symbol characters to be treated as separators.
      Returns:
      A string converted to pascal case.
    • pascalCaseWithKeep

      @Deprecated public static String pascalCaseWithKeep(String input, String kept)
      Converts the input string to pascal case with the specified characters to be kept.
      Parameters:
      input - The input string.
      kept - The symbol characters not to be treated as separators.
      Returns:
      A string converted to pascal case.
    • snakeCaseWithOptions

      public static String snakeCaseWithOptions(String input, Options opts)
      Converts the input string to snake case with the specified options.
      Parameters:
      input - The input string.
      opts - The options with specifies the ways of case conversion.
      Returns:
      A string converted to snake case.
    • snakeCase

      public static String snakeCase(String input)
      Converts the input string to snake case.

      It treats the end of a sequence of non-alphabetical characters as a word boundary, but not the beginning.

      Parameters:
      input - The input string.
      Returns:
      A string converted to snake case.
    • snakeCaseWithSep

      @Deprecated public static String snakeCaseWithSep(String input, String seps)
      Converts the input string to snake case with the specified separator characters.
      Parameters:
      input - The input string.
      seps - The symbol characters to be treated as separators.
      Returns:
      A string converted to snake case.
    • snakeCaseWithKeep

      @Deprecated public static String snakeCaseWithKeep(String input, String kept)
      Converts the input string to snake case with the specified characters to be kept.
      Parameters:
      input - The input string.
      kept - The symbol characters not to be treated as separators.
      Returns:
      A string converted to snake case.
    • trainCaseWithOptions

      public static String trainCaseWithOptions(String input, Options opts)
      Converts the input string to train case with the specified options.
      Parameters:
      input - The input string.
      opts - The options with specifies the ways of case conversion.
      Returns:
      A string converted to train case.
    • trainCase

      public static String trainCase(String input)
      Converts the input string to train case.

      It treats the end of a sequence of non-alphabetical characters as a word boundary, but not the beginning.

      Parameters:
      input - The input string.
      Returns:
      A string converted to train case.
    • trainCaseWithSep

      @Deprecated public static String trainCaseWithSep(String input, String seps)
      Converts the input string to train case with the specified separator characters.
      Parameters:
      input - The input string.
      seps - The symbol characters to be treated as separators.
      Returns:
      A string converted to train case.
    • trainCaseWithKeep

      @Deprecated public static String trainCaseWithKeep(String input, String kept)
      Converts the input string to train case with the specified characters to be kept.
      Parameters:
      input - The input string.
      kept - The symbol characters not to be treated as separators.
      Returns:
      A string converted to train case.