Navigation:  Reference > Functions >

ReplaceCharacters()

Print this Topic Previous pageReturn to chapter overviewNext page

 

REPLACE(1,2,3,4)

 

PURPOSE

This function will return a string with certain characters replaced with others.

 

PARTS

1 f/c/eRequired - The string/alpha field to use.

 

2 f/c/eRequired - The character(s) to replace. NOTE:  The value will not be trimmed automatically.  So, if there are extra spaces they will be used in the search.

 

3 f/c/eRequired - The new character(s) to use in place of number 2 above. NOTE:  The value will not be trimmed automatically.  So, if there are extra spaces they will be used in the replacement process.

 

4 f/c/eIf you want to ignore case then set this value to True, otherwise, the case of the characters will have to match that in option 2 above.

 

RETURN TYPE - A

NOTE : If the receiving field is too short, the remaining characters will be truncated.

 

SEE ALSO

MID

 

EXAMPLE

define tempStr type a size 19

tempstr = '0123-4567-890A-BCDE'

tempStr = replace(tempStr,'-',' ')

msg 'tempStr: '+tempStr

 

//The value displayed will be:  0123 4567 890A BCDE

 

//If you use fields instead of constants, and don't

//trim the extra spaces you could get something like this:

 

define s1,s2 type a size 5

s1 = '-'

s2 = ' '

tempstr = '0123-4567-890A-BCDE'

tempStr = replace(tempstr,trim(s1,'t'),s2)

 

//The value displayed will be:  0123     4567     8

 

 

 

 

 


Page url: http://www.cassoftware.com/tas/manual/replacecharacters().htm