Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting rid of carriage returns in memo fields
Message
From
20/08/1999 21:47:37
 
 
To
20/08/1999 21:31:48
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00256063
Message ID:
00256164
Views:
33
>Hi Ed,
>
>>That should work fine, and be quicker as well. The key is that both characters have to be replaced, and that they need not occur in matching pairs.
>
>Right, if you noticed my version had a chrtran instead of a strtran, which means the pairs thing is irrelavant right?
>
>try:
>?chrtran('m1i5k2e','1234567890','')

Correct - the character is in the second expression is replaced with the equivalent character in the third expression. STRTRAN() is needed when the string that need to be found for replacement is more than 1 character or where the replacement string for a given item is more than 1 character long, so that if you only wanted to strip CR/LF pairs (CHR(13)+CHR(10)), or wanted to replace each CHR(13) with the string "CARRIAGE RETURN", you'd have to use STRTRAN(). For example, I use the followiung to strip down multiple linefeeds to a single linefeed:

STRTRAN(test string, CHR(10) + CHR(10), CHR(10))

CHRTRAN() is better and faster in the case we're looking at, especially since it only has to be invoked once, and does it's thing in a single pass.
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
Next
Reply
Map
View

Click here to load this message in the networking platform