Skip to content
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

Title Case unwanted results #13

Open
Bokriem opened this issue Jun 30, 2020 · 3 comments
Open

Title Case unwanted results #13

Bokriem opened this issue Jun 30, 2020 · 3 comments

Comments

@Bokriem
Copy link

Bokriem commented Jun 30, 2020

Hi, using Title Case on the word iPhone results in I Phone, is there a quick fix for this?

@Bokriem
Copy link
Author

Bokriem commented Jun 30, 2020

it happens to all words starting with lowercase followed with the second letter as upper case

@nitehogg
Copy link
Collaborator

nitehogg commented Jul 7, 2020

Do you have an example of your full text input? The library breaks up words on common boundaries, based on common casing conventions. iPhone is camel-cased .. so it splits between the "i" and "P".

The next release will allow the caller to explicitly define the convention to parse, so if iPhone is just a word within a larger pattern, it may help. For example, you'd be able to call ReCase.fromSentenceCase("I'm a sucker with an iPhone") .. and it'd keep iPhone together, since it'd be separating by spaces.

The catch is that you'd never be able to convert it to a string where it retains the iPhone camel-casing. Even getting the string as camel-case would return i'mASuckerWithAnIphone

In the end the library expects common casing conventions as input, so that it knows how to break up the text and return it in another common casing convention.

@nitehogg
Copy link
Collaborator

nitehogg commented Jul 7, 2020

I have toyed around with the idea of allowing configurable exceptions also.. but that wouldn't solve the issue with the eventual strings not retaining their original casing.

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

No branches or pull requests

2 participants