Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do you remove blanks within a field
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00131900
Message ID:
00132013
Views:
13
>Is there a quick way to remove blanks within a field? For example PART NUMBER = 'TRG 011 4TGH 77K' to become 'TRG0114TGH77K'
>Thanks.

Hi Timothy,

Everyone's told you that using STRTRAN() is the solution to your problem, and, of course, they're right. I thought I'd give you another, related piece of advice about the function. I can't recommend your using a literal string here. It can make it hard to read. I'd suggest using either:

lcnewstring = STRTRAN(yourstring, SPACE(1), "")

or

lcreplace = SPACE(1)
lcnewstring = STRTRAN(yourstring, lcreplace, "")

It's much more readable, and, therefore, maintainable.

BTW, the third parameter isn't necessary. If it's eliminated STRTRAN() replaces the specified character with a "" anyway.

hth,
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform