Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
TRIM() that gets newline characters
Message
From
31/03/1999 12:11:26
 
 
To
31/03/1999 10:35:20
Tim Hockin
Illinois State U - Residential Computing
Normal, Illinois, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00203851
Message ID:
00203947
Views:
18
>>TRIM(CHRTRAN(lcText,CHR(10)," "))
>
>I guess I didn't make myself clear - I need to ONLY strip trailing newlines. Newlines followed by more text must be preserved...
>
>eg
>"blah blah blah
>
>blah blah
>
>
>"
>
>must become
>"blah blah blah
>
>blah blah"
>
>tough problem - I can't figure it out...
Trivial!
FUNCTION StripTrails
LPARAMETER cStringToStrip
LOCAL cStringOut, nLen
cStringOut = RTRIM(cStringToStrip)
DO WHILE LEN(cStringOut)> 0 AND INLIST(RIGHT(cStringToStrip,1),CHR(10),CHR(13))
   nLen = LEN(cStringOut) - 1
   cStringOut = RTRIM(LEFT(cStringOut,nLen))
ENDDO
RETURN cStringOut
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform