Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting rid of non-printable junk
Message
From
15/07/1999 11:34:56
Mark Hall
Independent Developer & Voip Specialist
Keston, Kent, United Kingdom
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00241748
Message ID:
00241784
Views:
11
>>>Does anyone know a simple command to get rid of all non-printable characters from a field. I have a nomenclature field and the user has been entering some carriage returns, tabs, and control characters (inadvertantly) Is there a way that I can get rid of those characters and leave the alpha numeric printable stuff. I know I can do a loop reading every character and checking for its ascii value, but what I was looking for was a function that can be used in a replace statement. TIA
>>
>>I use CHRTRAN in this situation
>>
>>e.g.
>>
>>*-- First decide what you want to get rid of
>>lcBadChars = CHR(13) + CHR(10) + CHR(9) + "'-&*%$£"
>>*-- Then dump them
>>REPLACE fieldname WITH CHRTRAN( fieldname, lcBadChars, "")
>
>Thanks I will give that a try. It is just getting a list of those that dont fall in the range I need that may be a problem.

Well, if you know what you do want, you can tackle the problem from the other end:-

lcGoodChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
lcBadChars = CHRTRAN( FieldValue, lcGoodChars, "")
REPLACE fieldname WITH CHRTRAN( fieldname, lcBadChars, "")
Regards
Mark

Microsoft VFP MCP
Menulib - OO Menus for VFP www.hidb.com/menulib
Previous
Reply
Map
View

Click here to load this message in the networking platform