Compatibility: Version 6.7.x and 6.8.x
Often it is necessary to clean data that has been entered or imported in order to remove unwanted characters. This tech tip presents a simple routine to get you started considering this concept, and reviews the use of character referencing.
Suppose you had data in which there were double quotes that you wanted to strip out. The following routine will perform this simple data cleansing task. This routine makes use of the character referencing symbols (◊ " on the Mac, or [[ ]] on Windows) to reference each character of the string being worked on by its position number within the string. This routine would be passed the string to be cleansed, for example from a field, and return the modified string, to be assigned back to the field.
`$1 The string to be cleaned
`$0 The string after being cleaned
$sQuote:=Char(Double quote ) `Convert the constant to a character
: ($tStringToClean◊$i"#$sQuote) `$tStringToClean◊$i" is the character by number for this pass through the loop.