Title Case
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 35
- Joined: Fri May 31, 2013 7:44 pm
Title Case
I had this is another thread but think I should start a new one for it.
Craig, I think you are telling me that there is no TitleCase function in LiveCode and I had better resurrect an ancient coding technique into LC language to roll my own. Maybe something like-separate chunks delineated by space, put each chunk toLower, get 1st char of each chunk & put toUpper, merge chunks back together. If that's right, since I would be using this on most all input fields, I should make it a function and put it somewhere? so as to have it available for including in every stack I create? N'est pas?
Before spending some time on this, am I on the right track or is there some other way? Thanks for the help.
Craig, I think you are telling me that there is no TitleCase function in LiveCode and I had better resurrect an ancient coding technique into LC language to roll my own. Maybe something like-separate chunks delineated by space, put each chunk toLower, get 1st char of each chunk & put toUpper, merge chunks back together. If that's right, since I would be using this on most all input fields, I should make it a function and put it somewhere? so as to have it available for including in every stack I create? N'est pas?
Before spending some time on this, am I on the right track or is there some other way? Thanks for the help.
Re: Title Case
Hi Sandy,
pardon my ignorance, but what does a "TitleCase" "function" do?
Best
Klaus
pardon my ignorance, but what does a "TitleCase" "function" do?

Best
Klaus
-
- Posts: 35
- Joined: Fri May 31, 2013 7:44 pm
Re: Title Case
TitleCase (sometimes called Mixed Case) puts the first letter of each word in uppercase and the rest of the word in lowercase. Very convenient for input of names of people, addresses, cities, books, etc especially when the user is low on grammatical skills and can just type everything in lowercase and have the program 'fix it' for him.
Re: Title Case
Then look at 'toUpper' in the dictionary...
for example...
for example...
Code: Select all
on mouseUp
put toLower( fld 1) into fld 1
repeat with count = 1 to the number of words of fld 1
put toUpper( char 1 of word count of fld 1) into char 1 of word count of fld 1
end repeat
end mouseUp
Re: Title Case
EX-ACTLY! 

-
- VIP Livecode Opensource Backer
- Posts: 10052
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Title Case
It may be helpful to add a list of words to leave as lower-case, like "of", "an", and", etc.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- Posts: 35
- Joined: Fri May 31, 2013 7:44 pm
Re: Title Case
OK thanks guys; I'll try Dixie's code first and adapt from there if necessary. So my 2nd question was about best practices I guess. Since you can drag any existing stack into the one you're working on, would you keep various scripts in a master file and copy the desired ones to the current stack, or is there a better way to avoid re-inventing the wheel with every program?