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:45:32
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
11/01/2003 06:56:38
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00740604
Message ID:
00740610
Views:
20
This message has been marked as a message which has helped 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
lcAlphaSet=""
for ix=asc('A') to asc('Z')
 lcAlphaSet=lcAlphaSet+chr(ix)
endfor
lcAlphaSet = lcAlphaSet+lower(lcAlphaSet)
lcStr = "Mc O'Connor"
lcReduced = CHRTRAN(lcStr,chrtran(lcStr,lcAlphaSet,''),'')  
? lcReduced
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform