>>Yes, I know, but I was hoping that there was a function to do this already. Thanks anyway for your time and code.
>Take a look at the STRTRAN() function
That is eventually what I ended up using. Unfortunately, I had to call STRTRAN() in a loop to remove all repetitve spaces. If anyone knows of a Windows API call to do this, I would be very interested to hear about it.
By the way, here is the code that I used:
LPARAMETERS tcString
LOCAL lcRetVal
LOCAL lnNewLen, lnOldLen
lcRetVal = ALLTRIM(tcString) && Remove leading a trailing spaces
lnNewLen = LEN(lcRetVal) && Length of string
lnOldLen = lnNewLen + 1 && Make sure that loop is done at least once
DO WHILE lnNewLen < lnOldLen && While more repetitive spaces exist...
lnOldLen = lnNewLen && Length before removal of spaces
lcRetVal = STRTRAN(lcRetVal, SPACE(2), SPACE(1))
&& Remove repetitive spaces
lnNewLen = LEN(lcRetVal) && Length after removal of spaces
ENDDO
RETURN lcRetVal
Thanks anyway!
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement