26-02-20 10:11 AM
Hi all,
Does anyone know a simple way to convert a text data item so that every letter after a space is a capital letter and the rest is lowercase? The data item could be made up of 1/2/3/4 etc words and could either already be in this format or could be all upper or all lower case.
Thanks.
26-02-20 12:20 PM
26-02-20 01:45 PM
26-02-20 05:35 PM
27-02-20 08:24 AM
27-02-20 02:29 PM
Result = System.Text.RegularExpressions.Regex.Replace(<your_string_here>, "(?<= )\w", Function(m) m.Value.ToUpper())
I'd personally go with Dave's solution as I try to avoid code stages for one-off pieces and there's not much reuse value with this solution.
Tuesday
is this still the only possible way? Is there no Function or object for that after five years. Thats a very complicated way for such an easy task.
Thank you for sharing it 🙂
11 hours ago
Hi SK,
Additionally, I'd strongly consider not doing the upper/lower case conversion in your process but make a separate dedicated process (or object) for it. This way you'll be able to re-use the logic in other processes too without having to duplicate it. Anyway, my two cents.
Happy coding!
------------------
Paul
Sweden
4 hours ago
Good morning, all.
So... In the spirit of Rube Goldberg, and not even being my most esoteric solution this week...
MS Excel has a function called "Proper" which does exactly what you are asking, though it does not address the state abbreviation case that @jorge.barajas raise.
Set Cell 'A1' with '=PROPER(B1)'
Your process then writes to cell 'B1' and copies the value from 'A1'
Continue until complete.
Just a thought. Not necessarily a good thought, but a thought nonetheless.
Enjoy,
Red