Message: 13 Date: Wed, 2 Jun 2004 21:44:05 -0700 From: Bill Vlahos <[EMAIL PROTECTED]> Subject: Text case changing To: How to use Revolution <[EMAIL PROTECTED]> Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset=US-ASCII; format=flowed
Revolution has the toUpper and toLower command which will convert an entire string. Is there something similar for capitalizing just the first letter as a built in function? I've come up with something that works but seems kind of hokey. Does anyone have a more elegant solution for this?
Just to make life a little more complicated, there are some names like O'Malley or MacKeif or McBeth where it isn't just the first character. My application does not have to deal with these situations but a general solution would.
Bill Vlahos
Bill,
The script below is something I have used in the past with a database containing 32,000 records. It won't catch everything. It is very quick.
Jim
on TitleCase
ask "What field?"
if it is empty then exit mouseUp
put field it into tList
put toLower(tList) into tList
put space & tab & "-" & "'" &comma & return into tDelims
put space into tLastChar
repeat for each char tChar in tList
if tLastChar is in tDelims then
put toUpper(tChar) after results
put tChar into tLastChar
else
put tChar after results
put tChar into tLastChar
end if
end repeat
repeat for each word tWord in tList
if char 1 to 3 of tWord = "mac" then
put "Mac" & toUpper(char 4 of tWord)&toLower(char 5 to 20 of tWord) into tWord
put tWord
end if
end repeat
put results into field "myField"
end TitleCase
_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution
