Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Find position 1st occurrence of nonnumeric value in a st
Message
De
10/01/2008 10:23:45
 
 
À
10/01/2008 10:08:36
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:
01280874
Vues:
20
Hi Peter,

Thanks. I thought of that myself, but this is for a data migration and it could be called hundreds of thousands of times for long strings. I was trying to optimize it somehow. I agree your idea is the safest approach and probably the most accurate.


>>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...
>
>Why not write a tiny routine? This one uses ISALPHA().
>
>
? FirstPosAlpha( "123456789 Boldorn" )
>
>FUNCTION FirstPosAlpha
>lparameter tcString
>local ln
>for ln = 1 to len( m.tcString )
>	if isalpha( substr( m.tcString, m.ln ) )
>		RETURN m.ln
>	endif
>next
>RETURN 0
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform