The best line I've found to test camel case-title-case features is a ridiculously ridiculous example that tests a lot of extreme cases. As far as I know, none of the previously published functions handled this correctly :
ToGetYourGEDInTimeASongAboutThe26ABCsIsOfTheEssenceButAPersonalIDCardForUser456InRoom26AContainingABC26TimesIsNotAsEasyAs123ForC3POOrR2D2Or2R2D
This should be converted to:
To get the GED on time, a 26 ABC song is essential, but a personal identification card for user 456 in room 26A containing 26 ABCs is not as simple as 123 for C3PO or R2D2 or 2R2D
If you want just a simple function that handles cases like the above (and more cases than many of the previous answers), here is the one I wrote. This code is not very elegant and not fast, but it is simple, understandable and works.
An online example of this is here: http://jsfiddle.net/q5gbye2w/56/
Alternatively, as suggested by the Barno user , using SugarJS is a simple solution if you do not mind using this library. However, I'm not sure if it handles the test string that I described above; I have not tried this on this entry.
Chris Kline Mar 12 '16 at 3:14 2016-03-12 03:14
source share