Here is a new challenge for you – capitalize the first letter of each word in a string.
For example:
q) f "I’m gonna make him an offer he can’t refuse"
"I'm Gonna Make Him An Offer He Can't Refuse"
Post your answers in the comment section below and let me know if you have any questions.
P.S. Don’t worry about the case with a trailing space i.e. “Hi how are you “
UPDATE:
Pet usa discount cialis birds can be quite high-priced. A decreased estimations of tadalafil may be the suitable and favorable option for the male suffering from impotence problem. free cialis no prescription Remember, fault is not in suffering, it’s in hiding. cute-n-tiny.com vardenafil price Certain fruits have been recognized to have much higher nutritional substance and antioxidant properties canadian levitra online than others. Great solutions everyone! We have quite a variety this time.
Here are all the solutions:
David - {@[x;0,1+where x=" ";upper]} (a more complete version in comments)
Rolf - {@[x;where" "=" ",x;upper]}
Showvik - {ssr[c;” ?”;upper]}
Bill - {s:” ” vs trim x;” “sv .[s;(til count s;0);upper]}
Me - {" " sv .[b;((til count b:" " vs x);(0;0));upper]}
David and Rolf have similar solutions. They used @
to modify the string.
Showvik has a more simplistic approach. He used ssr
function to search and replace parts of the string. The only issue is that it won’t cover the first word but that wasn’t specified as a requirement.
Bill and my solutions are both very similar (pretty much the same). We break down the string first and then modify at depth using .
operator and then reconstruct the string. It’s a little sophisticated and it’s simpler to use @
approach.
Thanks everyone for participating!