Title Text
Devin Asay
devin_asay at byu.edu
Wed Oct 27 13:01:43 EDT 2010
On Oct 27, 2010, at 10:50 AM, Richmond wrote:
> On 10/27/2010 07:34 PM, Devin Asay wrote:
>> On Oct 27, 2010, at 10:21 AM, Alex Adams wrote:
>>
>>> Is there a function that I can use to convert a string to title text (the
>>> first letter of each word is capitalized)? I can¹t find one in the
>>> dictionary. I could write a handler I suppose, but I¹m hoping there is
>>> something already available.
>> Alex,
>>
>> Here's a really basic one I have used. It actually let's you choose between sentence case and title case with an optional argument. But there is no checking for words that shouldn't be capitalized according to English capitalization rules, such as prepositions. But it's a start.
>>
>> function capitalize string,allWds
>> if allWds is true then
>> put number of words in string into limit
>> else
>> put 1 into limit
>> end if
>> repeat with i = 1 to limit
>> put toUpper(char 1 of word i of string) into char 1 of word i of string
>> end repeat
>> return string
>> end capitalize
> Presumably that only works for English ????
Right, that was the assumption, which I implied in the explanation. Obviously for other languages YMMV.
Devin
Devin Asay
Humanities Technology and Research Support Center
Brigham Young University
More information about the use-livecode
mailing list