Skip to content

new: added functions to convert with a number sequence as a word #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 12, 2024

Conversation

sttk
Copy link
Owner

@sttk sttk commented Aug 12, 2024

This PR is for resolving #18.

In this PR, the new five functions are added for converting a string into each case with inserting separators before number sequences.

  • cobol_case_with_nums_as_word
  • kebab_case_with_nums_as_word
  • macro_case_with_nums_as_word
  • snake_case_with_nums_as_word
  • train_case_with_nums_as_word

These functions can be used as follows:

use stringcase::snake_case_with_nums_as_word as snake_case;
snake_case("valueOf1");  // ==> "value-of-1"

In addition, this PR adds the new five methods of Caser corresponding to each function above.

  • Caser#cobol_case_with_nums_as_word
  • Caser#kebab_case_with_nums_as_word
  • Caser#macro_case_with_nums_as_word
  • Caser#snake_case_with_nums_as_word
  • Caser#train_case_with_nums_as_word

These methods can be used as follows:

use stringcase::Caser;
"valueOf1".to_snake_case_with_nums_as_word();  // ==> "value-of-1"

@sttk sttk merged commit 31b6d79 into main Aug 12, 2024
13 checks passed
@sttk sttk deleted the add-functions-to-convert-with-nums-as-word branch August 12, 2024 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant