Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
String manipulation (preferably without RegExp)
Message
 
 
To
06/11/2006 17:47:47
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:
01167520
Views:
7
It's easy to fix
lcStr = "W-4568E5B"
lcNum = CHRTRAN(lcStr, CHRTRAN(lcStr, "0123456789",""),"z")
DO WHILE NOT ISDIGIT(lcNum) AND NOT EMPTY(lcNum)
	lcNum = SUBSTR(lcNum,2)
ENDDO
>This will also fale on for instance lcStr = "W-4568E5B"
>
>
>>
>>lcStr = "W-4568S5B"
>>lcNum = lcStr
>>DO WHILE NOT ISDIGIT(lcNum) AND NOT EMPTY(lcNum)
>>	lcNum = SUBSTR(lcNum,2)
>>ENDDO
>>
>>? INT(VAL(lcNum))
>>
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform