If I have a field_name which is grammatically correct. And I want to separate it by using space.
For example,
- field_name is CylinderConfiguration, and I want it like Cylinder Configuration
- field_name is NoofCylinders, and I want it like No of Cylinders
Please note capitalization is not the recognizable character in the strings whole string may be in small.
Is there any way to do this?
You could do this by using the dictionary in
/usr/share/dict/words(or just downloading a word list).The algorithm in pseudo code would then go like this:
The down side with this is that any string starting with a or i will basically fail – a string like
algorithmwould be split intoaand then have no further matches. That means that you’d need to disallow certain words if you are confident you don’t use them. Also, compound words such asoftenordesktopwould not have the expected behaviour. Words that have a word in their root, e.g. ‘tablet’, ‘mobile’, ‘popular’ etc would also fail.With some tweaking, this could work though. I would make a custom word list rather than using the system dictionary if you know what words you use to speed things up and to avoid false positives.