Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Odd string replacement: STRTRAN but with embedded spaces
Message
From
14/11/2006 08:25:52
 
 
To
14/11/2006 08:17:50
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01169359
Message ID:
01169431
Views:
7
Change my cStop string according to your needs. My function simply calculates which is the first "not wanted" character, and then separates all character until this "not wanted" character is reached.

You may have to check for the "china" records by a separate function, or incorporate it into mine.

>I want the UPC Code to disappear, regardless of the position of the white space.
>
>Now, I know there's gonna be some fun with punctuation as well in some of the less frequent case, but I'm sure I can handle that when I get to it. For now:
>
>Main ways:
>"Big Widget 1 12345 12345 1" ==> "Big Widget"
>"Big Widget - 1 12345 12345 1" ==> "Big Widget - "
>
>Occurs a few times:
>"Big Widget (1 12345 12345 1)" ==> "Big Widget (1 12345 12345 1)"
>
>Once only:
>"Big Widget 1 12345 12345 1 / China" ==> "Big Widget / China"
>"Big Widget Green:1 12345 12345 1" ==> "Big Widget Green:"
>
>As noted before, the spaces within the UPC code in the field can occur anywhere; the pattern used here is just the most frequent usage.
>
>
>>I see your "input" data, but what do you want as output?
>>
>>>Tore -- from an earlier response of mine:
>>>
>>>Unfortunately, there's no absolute positioning involved here that can be counted on. Since this is a free form text field, what occurs is what you might expect: there are a couple of main ways that the UPC is represented, a main exception, and a couple of special cases:
>>>
>>>Main ways:
>>>"Big Widget 1 12345 12345 1"
>>>"Big Widget - 1 12345 12345 1"
>>>Occurs a few times:
>>>"Big Widget (1 12345 12345 1)"
>>>Once only:
>>>"Big Widget 1 12345 12345 1 / China"
>>>"Big Widget Green:1 12345 12345 1"
>>>
>>>Can't really count on anything, I'm afraid, other than that the UPC Code appears with white space.
>>>
>>>
>>>
Previous
Reply
Map
View

Click here to load this message in the networking platform