Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Removing Spaces from Charter String
Message
From
13/11/1999 10:55:03
 
 
To
12/11/1999 23:01:15
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00290863
Message ID:
00290928
Views:
16
>Using VFP6.0 SP3
>
>I'm tring to remove a space from a charter string exp("ABC 12345")
>!ISDIGIT copies the space
>ISDIGIT doen't copy the "ABC"
>
>TIA

Looks like you've found a solution, but I wanted to offer up one of my favorite VFP string functions: CHRTRAN().

YOu can use it to replace all characters in a stringthat match any character in another string with a third expression. In your particular case, you would just:

lcString = CHRTRAN(lcString, " ","")

But you can also do tons of other cool stuff, like remove any invalid characters:

lcString = CHRTRAN(lcString, "~!@#$%^&*?","")

Or getting even more creative, you can remove any character that does not
occur in a given string, so you can filter your string for only valid characters. Say a product code is only supposed to contain the digits 0-9 and the letters A-F, and all other characters should be removed-

lcString = CHRTRAN(lcString, CHRTRAN(lcString, "0123456789ABCDEF",""),"")
Erik Moore
Clientelligence
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform