Saturday, April 30, 2011

Re: is there s 'toinitialupper' function?

On 30 Apr 2011, at 00:47, John Beckett wrote:

> Tim Chase wrote:
>> let s=substitute(s, '\w\+', '\u\1', 'g')
>
> The above is intended to change each word in s, making the first
> letter uppercase and not changing the rest.
>
> The search pattern needs brackets, or the \1 should be replaced.
> The following works:
>
> let s=substitute(s, '\w\+', '\u&', 'g')

Tim/John

Thanks for your suggestions. That's much simpler than I was going to do (cut the word to pieces with strpart, capitalise with toupper, then join them back together).

Regards, Andy

--
Andrew Long
andrew dot long at mac dot com

No comments:

Post a Comment