Page 1 of 1

Insert Space in Full name

Posted: Wed Aug 12, 2009 10:28 am
by Eric
This command will take a name in the field called First that is formatted like this:
JohnSmith
(where the first and last name are together without a space and the last name has a capital letter)

and make it: John Smith

With your name in the field called first, pull down the Edit menu to Command, then run the command below:

Code: Select all

com_Char=65
com_Field="FIRST"
REPLACE &com_Field WITH LEFT(&com_Field,1)+STUFF(SUBSTR(&com_Field,2),AT(CHR(com_Char),SUBSTR(&com_Field,2)),0," ") ;
	FOR AT(CHR(com_Char),SUBSTR(&com_Field,2))>0
com_Char=com_Char+1
REPLACE &com_Field WITH LEFT(&com_Field,1)+STUFF(SUBSTR(&com_Field,2),AT(CHR(com_Char),SUBSTR(&com_Field,2)),0," ") ;
	FOR AT(CHR(com_Char),SUBSTR(&com_Field,2))>0
com_Char=com_Char+1
REPLACE &com_Field WITH LEFT(&com_Field,1)+STUFF(SUBSTR(&com_Field,2),AT(CHR(com_Char),SUBSTR(&com_Field,2)),0," ") ;
	FOR AT(CHR(com_Char),SUBSTR(&com_Field,2))>0
com_Char=com_Char+1
REPLACE &com_Field WITH LEFT(&com_Field,1)+STUFF(SUBSTR(&com_Field,2),AT(CHR(com_Char),SUBSTR(&com_Field,2)),0," ") ;
	FOR AT(CHR(com_Char),SUBSTR(&com_Field,2))>0
com_Char=com_Char+1
REPLACE &com_Field WITH LEFT(&com_Field,1)+STUFF(SUBSTR(&com_Field,2),AT(CHR(com_Char),SUBSTR(&com_Field,2)),0," ") ;
	FOR AT(CHR(com_Char),SUBSTR(&com_Field,2))>0
com_Char=com_Char+1
REPLACE &com_Field WITH LEFT(&com_Field,1)+STUFF(SUBSTR(&com_Field,2),AT(CHR(com_Char),SUBSTR(&com_Field,2)),0," ") ;
	FOR AT(CHR(com_Char),SUBSTR(&com_Field,2))>0
com_Char=com_Char+1
REPLACE &com_Field WITH LEFT(&com_Field,1)+STUFF(SUBSTR(&com_Field,2),AT(CHR(com_Char),SUBSTR(&com_Field,2)),0," ") ;
	FOR AT(CHR(com_Char),SUBSTR(&com_Field,2))>0
com_Char=com_Char+1
REPLACE &com_Field WITH LEFT(&com_Field,1)+STUFF(SUBSTR(&com_Field,2),AT(CHR(com_Char),SUBSTR(&com_Field,2)),0," ") ;
	FOR AT(CHR(com_Char),SUBSTR(&com_Field,2))>0
com_Char=com_Char+1
REPLACE &com_Field WITH LEFT(&com_Field,1)+STUFF(SUBSTR(&com_Field,2),AT(CHR(com_Char),SUBSTR(&com_Field,2)),0," ") ;
	FOR AT(CHR(com_Char),SUBSTR(&com_Field,2))>0
com_Char=com_Char+1
REPLACE &com_Field WITH LEFT(&com_Field,1)+STUFF(SUBSTR(&com_Field,2),AT(CHR(com_Char),SUBSTR(&com_Field,2)),0," ") ;
	FOR AT(CHR(com_Char),SUBSTR(&com_Field,2))>0
com_Char=com_Char+1
REPLACE &com_Field WITH LEFT(&com_Field,1)+STUFF(SUBSTR(&com_Field,2),AT(CHR(com_Char),SUBSTR(&com_Field,2)),0," ") ;
	FOR AT(CHR(com_Char),SUBSTR(&com_Field,2))>0
com_Char=com_Char+1
REPLACE &com_Field WITH LEFT(&com_Field,1)+STUFF(SUBSTR(&com_Field,2),AT(CHR(com_Char),SUBSTR(&com_Field,2)),0," ") ;
	FOR AT(CHR(com_Char),SUBSTR(&com_Field,2))>0
com_Char=com_Char+1
REPLACE &com_Field WITH LEFT(&com_Field,1)+STUFF(SUBSTR(&com_Field,2),AT(CHR(com_Char),SUBSTR(&com_Field,2)),0," ") ;
	FOR AT(CHR(com_Char),SUBSTR(&com_Field,2))>0
com_Char=com_Char+1
REPLACE &com_Field WITH LEFT(&com_Field,1)+STUFF(SUBSTR(&com_Field,2),AT(CHR(com_Char),SUBSTR(&com_Field,2)),0," ") ;
	FOR AT(CHR(com_Char),SUBSTR(&com_Field,2))>0
com_Char=com_Char+1
REPLACE &com_Field WITH LEFT(&com_Field,1)+STUFF(SUBSTR(&com_Field,2),AT(CHR(com_Char),SUBSTR(&com_Field,2)),0," ") ;
	FOR AT(CHR(com_Char),SUBSTR(&com_Field,2))>0
com_Char=com_Char+1
REPLACE &com_Field WITH LEFT(&com_Field,1)+STUFF(SUBSTR(&com_Field,2),AT(CHR(com_Char),SUBSTR(&com_Field,2)),0," ") ;
	FOR AT(CHR(com_Char),SUBSTR(&com_Field,2))>0
com_Char=com_Char+1
REPLACE &com_Field WITH LEFT(&com_Field,1)+STUFF(SUBSTR(&com_Field,2),AT(CHR(com_Char),SUBSTR(&com_Field,2)),0," ") ;
	FOR AT(CHR(com_Char),SUBSTR(&com_Field,2))>0
com_Char=com_Char+1
REPLACE &com_Field WITH LEFT(&com_Field,1)+STUFF(SUBSTR(&com_Field,2),AT(CHR(com_Char),SUBSTR(&com_Field,2)),0," ") ;
	FOR AT(CHR(com_Char),SUBSTR(&com_Field,2))>0
com_Char=com_Char+1
REPLACE &com_Field WITH LEFT(&com_Field,1)+STUFF(SUBSTR(&com_Field,2),AT(CHR(com_Char),SUBSTR(&com_Field,2)),0," ") ;
	FOR AT(CHR(com_Char),SUBSTR(&com_Field,2))>0
com_Char=com_Char+1
REPLACE &com_Field WITH LEFT(&com_Field,1)+STUFF(SUBSTR(&com_Field,2),AT(CHR(com_Char),SUBSTR(&com_Field,2)),0," ") ;
	FOR AT(CHR(com_Char),SUBSTR(&com_Field,2))>0
com_Char=com_Char+1
REPLACE &com_Field WITH LEFT(&com_Field,1)+STUFF(SUBSTR(&com_Field,2),AT(CHR(com_Char),SUBSTR(&com_Field,2)),0," ") ;
	FOR AT(CHR(com_Char),SUBSTR(&com_Field,2))>0
com_Char=com_Char+1
REPLACE &com_Field WITH LEFT(&com_Field,1)+STUFF(SUBSTR(&com_Field,2),AT(CHR(com_Char),SUBSTR(&com_Field,2)),0," ") ;
	FOR AT(CHR(com_Char),SUBSTR(&com_Field,2))>0
com_Char=com_Char+1
REPLACE &com_Field WITH LEFT(&com_Field,1)+STUFF(SUBSTR(&com_Field,2),AT(CHR(com_Char),SUBSTR(&com_Field,2)),0," ") ;
	FOR AT(CHR(com_Char),SUBSTR(&com_Field,2))>0
com_Char=com_Char+1
REPLACE &com_Field WITH LEFT(&com_Field,1)+STUFF(SUBSTR(&com_Field,2),AT(CHR(com_Char),SUBSTR(&com_Field,2)),0," ") ;
	FOR AT(CHR(com_Char),SUBSTR(&com_Field,2))>0
com_Char=com_Char+1
REPLACE &com_Field WITH LEFT(&com_Field,1)+STUFF(SUBSTR(&com_Field,2),AT(CHR(com_Char),SUBSTR(&com_Field,2)),0," ") ;
	FOR AT(CHR(com_Char),SUBSTR(&com_Field,2))>0
com_Char=com_Char+1
REPLACE &com_Field WITH LEFT(&com_Field,1)+STUFF(SUBSTR(&com_Field,2),AT(CHR(com_Char),SUBSTR(&com_Field,2)),0," ") ;
	FOR AT(CHR(com_Char),SUBSTR(&com_Field,2))>0
REPLACE ALL &com_Field with REDUCE(&com_Field)