Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
String manipulation (preferably without RegExp)
Message
From
06/11/2006 18:29:04
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01167490
Message ID:
01167527
Views:
9
>>>Hi everybody,
>>>
>>>I have a character string representing Style which consists of the following portions:
>>>
>>>Color (1 letter with - or without -) Type (one or 2 letters) Number portion (could be any number but usually no more than 5 digits and not less than 2) then Stone (1 letter) then quality (number) then color quality (1 letter), e.g. for example:
>>>W-4568S5B
>>>E460D4
>>>E94E
>>>
>>>Now, all these portions are optional except for number portion. My task is to get the number portion first, then try to search, if we have a file with the same number, same first portion, same stone (if it was present), different quality. Then if there are no files with the same stone, I need to do other string manipulations.
>>>
>>>Can you help me to get Number portion first?
>>
>>Why not the usual trick with getting the digits only?
>>
>>lcJustDigits=chrtran(chrtran(lcAll, "0123456789",""),"")
>
>It's not going to work becase there could be two numeric parts, e.g. W-4568S5B

OK (I was distracted by the phone - didn't really notice), so we'd need a correction:

lcJustDigits=chrtran(chrtran(lcAll, "0123456789",""),space(len(lcAll)))
lcNr1=getwordnum(lcJustDigits,1)
lcNr2=getwordnum(lcJustDigits,2)

Then just get the val() of these two.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform