!Coded by Rakesh Subhagan, PSoftSearch.com !Date: 14 - Jun - 2008 !Code for removing special characters from a string !Here we use the ideology that we have a finite set of !valid charecters (alpha numeric) while the set of special !characters is fairly big !$Descr will give the final string without special chars. Let $valid_chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz -./0123456789"' !These are the only characters that will be left in the string. Let $invalid_chars = translate(&DESCR254, $valid_chars, '') !Finding the special characters that are in the string by removing !each occurance of the valid characters fromt the string. Let #invalid = length($invalid_chars) !Getting the count of invalid characters If #invalid !If there were some invalid characters Let $Descr = translate(&DESCR254, $invalid_chars, '') !Replace all invalid characters in the source string with NULL Else !If there were no invalid characters Let $Descr = &DESCR254 !Copy source string to output string as there were no special chars End-if