>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