Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Find position 1st occurrence of nonnumeric value in a st
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01280661
Message ID:
01280759
Vues:
26
>>lcmyString = "123456789 Boldorn"
>>
>>I want to return position 11 because it is the first non numeric position (B). just can't think of it today...
>
>Tracy,
>
>Please try
>
>lcNewString = alltrim(chrtran(myString, [1234567890],space(10)))
>
>?at(lcNewString, myString)
>
>Not tested.

After second thought, though still not tested:
lcNewString = alltrim(chrtran(myString, [1234567890],' '))

lnPos = at(" ", m.lcNewString)

if m.lnPos > 0
  lcNewString = substr(m.lcNewString,1, m.lnPos - 1)
endif

?at(lcNewString, myString)
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform