Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Trim function to remove blanks + returns
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00004308
Message ID:
00004332
Views:
35
>>>FUNCTION NoCr(tcString)
>>>tcString = ALLTRIM(tcString)
>>>DO WHILE RIGHT(tcString,1) = CHR(13) AND !EMPTY(tcString)
>>> tcString = SUBSTR(tcString,1,LEN(tcString)-1)
>>>ENDDO
>>>RETURN tcString
>>
>>Thanks. I changed a few things.
>>
>>FUNCTION NoCr(tcString)
>>tcString=ALLTRIM(tcString)
>>DO WHILE INLIST(RIGHT(tcString,1),CHR(13),CHR(10),CHR(160)) AND NOT EMPTY(tcString)
>> tcString=ALLTRIM(SUBSTR(tcString,1,LEN(tcString)-1))
>>ENDDO
>>RETURN tcString
>mike,
>
>id say that chris deserves the VP award (your improvements were not specified in original requirements)! good one chris! elegant even!


Lucien,
Thanks for the kind words.

I am suprised, however, that no one BUSTED ME on the
fact that you don't really have to check for an
EMPTY() string in the DO WHILE!

Chris
Chris
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform