Function to Upper and Lower Case sentences

Sivakatirswami katir at hindu.org
Wed Dec 21 16:02:40 EST 2011


OK yes, Title case is easy... It's sentence case I was looking for 
because a period/dot is not part of a word. I guess one could use a dot 
as a line delimiter and then step thru the lines.



On 12/21/11 10:57 AM, Bob Sneidar wrote:
> On Dec 21, 2011, at 12:43 PM, Sivakatirswami wrote:
>
>> I have a need to take all caps input  and
>>
>> 1) Lower case all but first letter of sentences
>>
>> 2) Upper case words in a small dictionary I will provide to the function.
>>
>> As anyone cooked up something like this already... if I just had 1) can manage 2)
>>
>> Happy Holidays!
>>
>> Om Shanti
>> Sivakatirswami
>>
>> Kauai Aadheenam
>>
>> __________________________
> function titleCase theText, forceIt
>      if forceIt is true then
>          put tolower(theText) into theText
>      end if
>
>      repeat with theWordNum = 1 to the number of words of theText
>          put toupper(char 1 of word theWordNum of theText)&  \
>                  char 2 to -1 of word theWordNum of theText \
>                  into word theWordNum of theText
>      end repeat
>
>      return theText
> end titleCase
>
>
> _______________________________________________
>





More information about the use-livecode mailing list