Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Extracting Numeric Value from String
Message
From
19/09/2017 10:54:41
 
 
To
19/09/2017 10:18:31
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 8.1
Network:
Windows XP
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01654431
Message ID:
01654437
Views:
51
>>Dear Sir please Guide,
>>
>>I have Data as
>>
>>Case-1
>>Ps="F11 B (GENERAL MANAGER \(PROJECT\))31 585 w"
>>
>>Case-2
>>Ps="F11 B (GENERAL MANAGER \(PROJECT\)) 31 585 w"
>>
>>Need to Extrcat value 31 in from the above strings.
>>
>>I am using the following code
>>
>>nColumnposition=VAL(Getwordnum(PS, Getwordcount(PS) - 2))
>>
>>
>>For case 2 i am getting the proper result as there is a space between ) & 31 but for case 1 I am getting the entire string.
>>
>>The value of column may be of three digits also i.e instead of 31 it may be 311 also.
>>
>>What may be the proper solution to the above
>>
>>Regards
>
>What is your criteria to get 31 in both cases? If it is the first "number after last closing parentheses" then:
>
>
>?Ltrim(Str(val(Substr(m.ps,Rat(")",m.ps)+1))))
>
>
>Depending on your criteria and what exactly you want, a regexp based solution might be better.



Thanks sir, its working
Harsh
Previous
Reply
Map
View

Click here to load this message in the networking platform