Page 1 of 1

Case Change

Posted: Sat Sep 05, 2015 5:43 pm
by Ralph Forehand
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

Re: Case Change

Posted: Sat Sep 05, 2015 5:49 pm
by andrewferguson
Hi,
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
Andrew

Re: Case Change

Posted: Sun Sep 06, 2015 9:27 pm
by quailcreek
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

Re: Case Change

Posted: Mon Sep 07, 2015 2:31 pm
by Ralph Forehand
Andrew and Tom,

Thank You for your input. You were very helpful :D and as usual, this Forum is a great resource for :idea: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