>Thank you Cetin. Although a little more complicated solution than Hilmar's, it will be worth to check it out.
>Thank you for your time.
>
>Ulises
Oh just checked it. Not more complicated. Added nonalpha char removal :)
For only space corresponding code is :
lcReduced = CHRTRAN(lcStr,' ','')
lcAlphaSet=""
for ix=asc('A') to asc('Z')
lcAlphaSet=lcAlphaSet+chr(ix)
endfor
lcAlphaSet = lcAlphaSet+lower(lcAlphaSet)
Above part creates a string of alpha chars (assuming US alphabet only). Result string is something like "ABCD...Zabcd...z".
lcReduced = CHRTRAN(lcStr,chrtran(lcStr,lcAlphaSet,''),'')
Inner chrtran(lcStr,lcAlphaSet,'') removes all alpha chars from string, leaving out nonalpha ones (including space).
Applying inner chrtran's result string to chrtran(lcStr, NonAlphaOnly, '') gives only alpha chars in string.
Maybe it's easier to understand with getting only digits from a string (ie: You want to get 821 from "LAP8-21") :
lcStr = "LAP8-21"
lcDigits = "0123456789" && This is like AlphaSet - Digitset
lcInnerChrtran = chrtran(lcStr, lcDigits, '') && "LAP-"
*chrtran(lcStr, "LAP-", '') && Remove "LAP-" chars from lcStr
lcOuterChrTran = chrtran(lcStr, lcInnerChrTran, '')
If you knew what nonalpha charset would be it is shorter :
MyNonAlphaChars = " '!@#..."+["]
*Replace all chars of lcStr with 'nothing' if it's in MyNonAlphaChars
lcReduced = chrtran(lcStr,MyNonAlphaChars,'')
Cetin