Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Remove empty and non-alpha chars in string?
Message
 
 
To
11/01/2003 06:56:38
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00740604
Message ID:
00741043
Views:
25
If you only want A-Z, a-z characters:

lcString = [3dorXs$%Rk@)L(*&w3er~ AgjCioe]
lcAllowed = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]

? CHRTRAN(lcString, CHRTRAN(lcString, lcAllowed, ''), '')

If you allow alpha and numbers:

lcAllowed = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890]
? CHRTRAN(lcString, CHRTRAN(lcString, lcAllowed, ''), '')

>Hi all.
>I have a small routine that builds the number of the next purchase order for a small company. What this does is: 1.- Takes de first 3 letters of the name of the supplier; 2.- counts how many orders this supplier has +1; 3.- counts how many p.o. have been made +1, and builds the number adding a '-' between the last 2 numbers so a p.o. number like KEY8-21 would mean 8 p.o. to supplier Keystone out of 21 total p.o.'s made. I want to avoid the possibility of a blank character in either the 2nd or 3rd position of the 3 letter string (ie. La Palma) and the elimination of non alphabetical characters (ie. O'Connor). ALLTRIM(), RTRIM() AND LTRIM() only remove trailing or leading blanks. How can I remove middle blanks and non alphabetical characters and still construct the 3 letter string with the remaining characters? (A supplier's name like 'La Palma' gives me a p.o. number like LA 8-21. I need LAP8-21)
>Thank you for your time
>
>Ulises
Mark McCasland
Midlothian, TX USA
Previous
Reply
Map
View

Click here to load this message in the networking platform