Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Find position 1st occurrence of nonnumeric value in a st
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01280661
Message ID:
01280871
Views:
14
>>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
Peter,

With long strings it may be not the best approach.

I believe my solution from the Re: Find position 1st Occurance of nonnumeric value in a str Thread #1280661 Message #1280759 should be more simple and efficient.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform