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


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to