Class StringCase
- Ada_Case
- camelCase
- COBOL-CASE
- kebab-case
- MACRO_CASE
- PascalCase
- snake_case
- Title Case
- Train-Case
- Since:
- 1.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringConverts the input string to Ada case.static StringadaCaseWithOptions(String input, Options opts) Converts the input string to Ada case with the specified options.static StringConverts the input string to camel case.static StringcamelCaseWithOptions(String input, Options opts) Converts the input string to camel case with the specified options.static Stringcapitalize(String input, char joiner, Options opts) Converts the input string by capitalizing the first ASCII letter of each word and lowercasing subsequent letters, inserting the specified joinercharbetween word boundaries according to the given options.static Stringcapitalize(String input, int joiner, Options opts) Converts the input string by capitalizing the first ASCII letter of each word and lowercasing subsequent letters, inserting the specified joiner code point between word boundaries according to the given options.static StringConverts the input string to cobol case.static StringcobolCaseWithOptions(String input, Options opts) Converts the input string to cobol case with the specified options.static StringConverts the input string to kebab case.static StringkebabCaseWithOptions(String input, Options opts) Converts the input string to kebab case with the specified options.static StringConverts all ASCII alphabetic characters in the input string to lowercase, inserting the specified joinercharbetween word boundaries according to the given options.static StringConverts all ASCII alphabetic characters in the input string to lowercase, inserting the specified joiner code point between word boundaries according to the given options.static StringConverts the input string to macro case.static StringmacroCaseWithOptions(String input, Options opts) Converts the input string to macro case with the specified options.static StringpascalCase(String input) Converts the input string to pascal case.static StringpascalCaseWithOptions(String input, Options opts) Converts the input string to pascal case with the specified options.static StringConverts the input string to snake case.static StringsnakeCaseWithOptions(String input, Options opts) Converts the input string to snake case with the specified options.static StringConverts the input string to title case.static StringtitleCaseWithOptions(String input, Options opts) Converts the input string to title case with the specified options.static StringConverts the input string to train case.static StringtrainCaseWithOptions(String input, Options opts) Converts the input string to train case with the specified options.static StringConverts all ASCII alphabetic characters in the input string to uppercase, inserting the specified joinercharbetween word boundaries according to the given options.static StringConverts all ASCII alphabetic characters in the input string to uppercase, inserting the specified joiner code point between word boundaries according to the given options.
-
Method Details
-
upperize
Converts all ASCII alphabetic characters in the input string to uppercase, inserting the specified joinercharbetween word boundaries according to the given options. It serves as a core engine for transforming input strings into uppercase-based casing styles, such as MACRO_CASE or COBOL-CASE, using custom joinerchars and customizable word separation rules defined in Options.During conversion, all ASCII lowercase letters are converted to ASCII uppercase letters, and word boundaries are automatically recognized between casing transitions, such as between lowercase and uppercase letters or before the final uppercase letter of an acronym preceding a lowercase sequence. When non-alphanumeric characters are encountered, ASCII digits are kept by default, while other characters are evaluated against
Options. Ifopts.Separatorsis non-empty, characters matchingopts.Separatorsare removed as separators while other non-alphanumeric characters are kept; otherwise, ifopts.Keepis non-empty, specified characters are kept and all other non-alphanumeric characters are removed. If neither is specified, all non-alphanumeric characters are treated as separators and removed. The fieldsopts.SeparateBeforeNonAlphabetsandopts.SeparateAfterNonAlphabetsfurther determine whether word boundaries are inserted before or after non-alphabetic sequences.This static method never throws an exception on any input, returning an empty string when the input is empty. Casing transformations and word boundary detections apply strictly to ASCII letters, treating non-ASCII characters as non-alphanumeric. If both
opts.Separatorsandopts.Keepare specified,opts.Separatorstakes precedence andopts.Keepis ignored, while any alphanumeric characters listed in either field are disregarded. Additionally, leading and trailing separator characters are trimmed from the result without producing leading or trailing joiners.- Parameters:
input- The input string.joiner- A joinerchar.opts- TheOptionsobject which holds the fields to customize separation rules.- Returns:
- The converted string.
-
upperize
Converts all ASCII alphabetic characters in the input string to uppercase, inserting the specified joiner code point between word boundaries according to the given options. It serves as a core engine for transforming input strings into uppercase-based casing styles, such as MACRO_CASE or COBOL-CASE, using custom joiner code points and customizable word separation rules defined in Options.During conversion, all ASCII lowercase letters are converted to ASCII uppercase letters, and word boundaries are automatically recognized between casing transitions, such as between lowercase and uppercase letters or before the final uppercase letter of an acronym preceding a lowercase sequence. When non-alphanumeric characters are encountered, ASCII digits are kept by default, while other characters are evaluated against
Options. Ifopts.Separatorsis non-empty, characters matchingopts.Separatorsare removed as separators while other non-alphanumeric characters are kept; otherwise, ifopts.Keepis non-empty, specified characters are kept and all other non-alphanumeric characters are removed. If neither is specified, all non-alphanumeric characters are treated as separators and removed. The fieldsopts.SeparateBeforeNonAlphabetsandopts.SeparateAfterNonAlphabetsfurther determine whether word boundaries are inserted before or after non-alphabetic sequences.This static method never throws an exception on any input, returning an empty string when the input is empty. Casing transformations and word boundary detections apply strictly to ASCII letters, treating non-ASCII characters as non-alphanumeric. If both
opts.Separatorsandopts.Keepare specified,opts.Separatorstakes precedence andopts.Keepis ignored, while any alphanumeric characters listed in either field are disregarded. Additionally, leading and trailing separator characters are trimmed from the result without producing leading or trailing joiners.- Parameters:
input- The input string.joiner- A joiner code point.opts- TheOptionsobject which holds the fields to customize separation rules.- Returns:
- The converted string.
-
lowerize
Converts all ASCII alphabetic characters in the input string to lowercase, inserting the specified joinercharbetween word boundaries according to the given options. It serves as a core engine for transforming input strings into lowercase-based casing styles, such as snake_case or kebab-case, using custom joinerchars and customizable word separation rules defined in Options.During conversion, all ASCII uppercase letters are converted to ASCII lowercase letters, and word boundaries are automatically recognized between casing transitions, such as between lowercase and uppercase letters or before the final uppercase letter of an acronym preceding a lowercase sequence. When non-alphanumeric characters are encountered, ASCII digits are kept by default, while other characters are evaluated against
Options. Ifopts.Separatorsis non-empty, characters matchingopts.Separatorsare removed as separators while other non-alphanumeric characters are kept; otherwise, ifopts.Keepis non-empty, specified characters are kept and all other non-alphanumeric characters are removed. If neither is specified, all non-alphanumeric characters are treated as separators and removed. The fieldsopts.SeparateBeforeNonAlphabetsandopts.SeparateAfterNonAlphabetsfurther determine whether word boundaries are inserted before or after non-alphabetic sequences.This static method never throws an exception on any input, returning an empty string when the input is empty. Casing transformations and word boundary detections apply strictly to ASCII letters, treating non-ASCII characters as non-alphanumeric. If both opts.Separators and
opts.Keepare specified,opts.Separatorstakes precedence andopts.Keepis ignored, while any alphanumeric characters listed in either field are disregarded. Additionally, leading and trailing separator characters are trimmed from the result without producing leading or trailing joiners.- Parameters:
input- The input string.joiner- A joinerchar.opts- TheOptionsobject which holds the fields to customize separation rules.- Returns:
- The converted string.
-
lowerize
Converts all ASCII alphabetic characters in the input string to lowercase, inserting the specified joiner code point between word boundaries according to the given options. It serves as a core engine for transforming input strings into lowercase-based casing styles, such as snake_case or kebab-case, using custom joiner code points and customizable word separation rules defined in Options.During conversion, all ASCII uppercase letters are converted to ASCII lowercase letters, and word boundaries are automatically recognized between casing transitions, such as between lowercase and uppercase letters or before the final uppercase letter of an acronym preceding a lowercase sequence. When non-alphanumeric characters are encountered, ASCII digits are kept by default, while other characters are evaluated against
Options. Ifopts.Separatorsis non-empty, characters matchingopts.Separatorsare removed as separators while other non-alphanumeric characters are kept; otherwise, ifopts.Keepis non-empty, specified characters are kept and all other non-alphanumeric characters are removed. If neither is specified, all non-alphanumeric characters are treated as separators and removed. The fieldsopts.SeparateBeforeNonAlphabetsandopts.SeparateAfterNonAlphabetsfurther determine whether word boundaries are inserted before or after non-alphabetic sequences.This static method never throws an exception on any input, returning an empty string when the input is empty. Casing transformations and word boundary detections apply strictly to ASCII letters, treating non-ASCII characters as non-alphanumeric. If both opts.Separators and
opts.Keepare specified,opts.Separatorstakes precedence andopts.Keepis ignored, while any alphanumeric characters listed in either field are disregarded. Additionally, leading and trailing separator characters are trimmed from the result without producing leading or trailing joiners.- Parameters:
input- The input string.joiner- A joiner code point.opts- TheOptionsobject which holds the fields to customize separation rules.- Returns:
- The converted string.
-
capitalize
Converts the input string by capitalizing the first ASCII letter of each word and lowercasing subsequent letters, inserting the specified joinercharbetween word boundaries according to the given options. It serves as a core engine for transforming input strings into capitalized casing styles, such as Train-Case or PascalCase, using custom joinercodes and customizable word separation rules defined inOptions.During conversion, the initial ASCII letter of each word is converted to ASCII uppercase, while subsequent ASCII letters in that word are converted to ASCII lowercase. Word boundaries are automatically recognized at casing transitions, such as between lowercase and uppercase letters or before the final uppercase letter of an acronym preceding a lowercase sequence. When non-alphanumeric characters are encountered, ASCII digits are kept by default, while other characters are evaluated against
Options. Ifopts.Separatorsis non-empty, characters matchingopts.Separatorsare removed as separators while other non-alphanumeric characters are kept; otherwise, ifopts.Keepis non-empty, specified characters are kept and all other non-alphanumeric characters are removed. If neither is specified, all non-alphanumeric characters are treated as separators and removed. The fieldsopts.SeparateBeforeNonAlphabetsandopts.SeparateAfterNonAlphabetsfurther determine whether word boundaries are inserted before or after non-alphabetic sequences.This static method never throws an exception on any input, returning an empty string when the input is empty. Casing transformations and word boundary detections apply strictly to ASCII letters, treating non-ASCII characters as non-alphanumeric. If both
opts.Separatorsandopts.Keepare specified,opts.Separatorstakes precedence andopts.Keepis ignored, while any alphanumeric characters listed in either field are disregarded. Additionally, leading and trailing separator characters are trimmed from the result without producing leading or trailing joiners.- Parameters:
input- The input string.joiner- A joinerchar.opts- TheOptionsobject which holds the fields to customize separation rules.- Returns:
- The converted string.
-
capitalize
Converts the input string by capitalizing the first ASCII letter of each word and lowercasing subsequent letters, inserting the specified joiner code point between word boundaries according to the given options. It serves as a core engine for transforming input strings into capitalized casing styles, such as Train-Case or PascalCase, using custom joiner code points and customizable word separation rules defined inOptions.During conversion, the initial ASCII letter of each word is converted to ASCII uppercase, while subsequent ASCII letters in that word are converted to ASCII lowercase. Word boundaries are automatically recognized at casing transitions, such as between lowercase and uppercase letters or before the final uppercase letter of an acronym preceding a lowercase sequence. When non-alphanumeric characters are encountered, ASCII digits are kept by default, while other characters are evaluated against
Options. Ifopts.Separatorsis non-empty, characters matchingopts.Separatorsare removed as separators while other non-alphanumeric characters are kept; otherwise, ifopts.Keepis non-empty, specified characters are kept and all other non-alphanumeric characters are removed. If neither is specified, all non-alphanumeric characters are treated as separators and removed. The fieldsopts.SeparateBeforeNonAlphabetsandopts.SeparateAfterNonAlphabetsfurther determine whether word boundaries are inserted before or after non-alphabetic sequences.This static method never throws an exception on any input, returning an empty string when the input is empty. Casing transformations and word boundary detections apply strictly to ASCII letters, treating non-ASCII characters as non-alphanumeric. If both
opts.Separatorsandopts.Keepare specified,opts.Separatorstakes precedence andopts.Keepis ignored, while any alphanumeric characters listed in either field are disregarded. Additionally, leading and trailing separator characters are trimmed from the result without producing leading or trailing joiners.- Parameters:
input- The input string.joiner- A joiner code point.opts- TheOptionsobject which holds the fields to customize separation rules.- Returns:
- The converted string.
-
camelCaseWithOptions
-
camelCase
-
cobolCaseWithOptions
-
cobolCase
-
kebabCaseWithOptions
-
kebabCase
-
macroCaseWithOptions
-
macroCase
-
pascalCaseWithOptions
-
pascalCase
-
snakeCaseWithOptions
-
snakeCase
-
trainCaseWithOptions
-
trainCase
-
adaCaseWithOptions
-
adaCase
-
titleCaseWithOptions
-
titleCase
-