If you know what characters are or are not allowed --
lcAllowed = [ABCDEFG]
lcString = [aBcDeFg]
? CHRTRAN(lcString, CHRTRAN(lcString, lcAllowed, []), [])
You can turn the above into a function, then just do a REPLACE ALL...
REPLACE ALL MyField with StripBadChars(MyField)
If if no "disallowed" characters are found, the field contents will remain the same.
>I need to remove unprintable characters from existing tables. My approch is to
>
>1. use AFIELDS function to find character and memo fields in a table
>2. For character field SCAN the table for each character field
> a. use CHRTRAN functuin to eliminate unprintable characters
> b. find lenght of new and old strings
> i. if lengths are diffrent replace old value with new one
>
>My Questions
>
>A. Is there a more efficent method of doining this?
>B. How can I remove multiple spaces so that there is only 1 space between text?
>C. Will this work for memo fields?
>
>Eventual goal is to a form where user picks the table to be fixed so that paths will be set. For testing I am writing this as a program.
Mark McCasland
Midlothian, TX USA