Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Stripping space from strings
Message
From
25/11/1996 23:51:28
 
 
To
25/11/1996 19:27:52
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00013477
Message ID:
00013492
Views:
27
>How do I strip out extra spaces and carriage returns and line feeds from character strings that are in memo fields?

Here's a fantastic NoCr() function.
FUNCTION NoCr(tcString)
tcString=ALLTRIM(tcString)
DO WHILE INLIST(LEFT(tcString,1),CHR(13),CHR(10),CHR(160)) AND LEN(tcString)>0
   tcString=SUBSTR(tcString,2)
ENDDO
DO WHILE INLIST(RIGHT(tcString,1),CHR(13),CHR(10),CHR(160)) AND LEN(tcString)>0
   tcString=SUBSTR(tcString,1,LEN(tcString)-1)
ENDDO
RETURN tcString
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform