Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Extracting Numeric Value from String
Message
De
19/09/2017 10:33:28
 
 
À
19/09/2017 09:59:36
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 8.1
Network:
Windows XP
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01654431
Message ID:
01654434
Vues:
70
If you're sure that the sequence of figures you're searching for is:

  • after the last ')'
  • before a space

then here is a solution:
result = substr(m.PS, rat_c(')', m.PS) + 1) && sub-string starting just after the last parenthesis…
result = alltrim(left(m.result, at(' ', m.result))) && …trimmed at the first space
if the conditions are more complex you might need a regular expression.

>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
Thierry Nivelet
FoxinCloud
Give your VFP application a second life, web-based, in YOUR cloud
http://foxincloud.com/
Never explain, never complain (Queen Elizabeth II)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform