Is there a simple way of changing Case letters in a name?
Example; change JONES to Jones
and JONES-SMITH to Jones-Smith
Thanks for any suggestions.
Ralph
Case Change
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Livecode Opensource Backer
- Posts: 42
- Joined: Thu Jan 04, 2007 8:05 pm
- Location: Maryland, USA
Case Change
"Do the right thing and everything else will take care of it's self."
-
- VIP Livecode Opensource Backer
- Posts: 184
- Joined: Wed Apr 10, 2013 5:09 pm
Re: Case Change
Hi,
The function you are looking for is the toLower. This converts all uppercase letters in a string to their lowercase equivalent. For example:
Andrew
The function you are looking for is the toLower. This converts all uppercase letters in a string to their lowercase equivalent. For example:
Code: Select all
put the toLower of "HELLO WORLD" --results in "hello world"
put the toLower of "Hello World" --results in "hello world"
put the toLower of "hello world" --no change as there is no uppercase characters
-
- Posts: 746
- Joined: Sun Feb 04, 2007 11:01 pm
- Location: McKenna, WA
Re: Case Change
Here's command I use to set the first letter of each word to caps.
Code: Select all
put fld "List" into tFldList
upCase tFldList
command UpCase @pString
local x
repeat with x=1 to the number of words in pString
put upper(char 1 of word x of pString) into char 1 of word x of pString
end repeat
return pString
end UpCase
Tom
MacBook Pro OS Mojave 10.14
MacBook Pro OS Mojave 10.14
-
- Livecode Opensource Backer
- Posts: 42
- Joined: Thu Jan 04, 2007 8:05 pm
- Location: Maryland, USA
Re: Case Change
Andrew and Tom,
Thank You for your input. You were very helpful and as usual, this Forum is a great resource for s .
Hers's the solution I ended up with;
Thank You for your input. You were very helpful and as usual, this Forum is a great resource for s .
Hers's the solution I ended up with;
Code: Select all
repeat with iy = 1 to 35 -- List with 35 Name formasts to change
put item 2 of line iy of fld "Misc_Info" into Name1
-- Put "JONES-SMITH" or "SMITH" into Name1 -> Change to "Jones-Smith" or "Smith"
put tolower(Name1) into Name2 -- set all letters to lower case
put char 1 of Name1 into char 1 of Name2 -- Capitalize 1 letter of Name
put offset("-", Name2) into XT -- Name includes hyphen?
if XT > 0 then -- Capitalize letter after hyphen
put toUpper(char XT+1 of Name2) into Namex
put Namex into char xT+1 of Name2
end if
put Name2 into item 2 of line iy of fld "Misc_Info"
end repeat
"Do the right thing and everything else will take care of it's self."