Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Remove empty and non-alpha chars in string?
Message
From
11/01/2003 07:02:40
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
11/01/2003 06:56:38
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00740604
Message ID:
00740605
Views:
25
This message has been marked as the solution to the initial question of the thread.
>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

You can eliminate spaces and other selected characters with strtran():
? strtran("ab cd", " ", "")
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform