07-14-2009, 02:17 PM
Hi Bavnah,
Please find the below code which will give a simple solution.In this LOC we did not consider ever "is".
Let me know if it's OK with you or do you want any other methods.
Thanks,
QTPKing.
Please find the below code which will give a simple solution.In this LOC we did not consider ever "is".
Code:
str="this is my test string with 100% coverage."
Flag=False
NumChars=0
For i = 1 to len(str)
' msgbox mid (str,i,1)
If isnumeric(mid(str,i,1))=True Then
If Flag = False Then
Flag=True
StartPoint= i
NumChars=NumChars+1
Else
NumChars=NumChars+1
End if
End If
Next
msgbox NumChars
If NumChars > 0 Then
msgbox mid(str,StartPoint,NumChars)
msgbox "My Desired value = " & mid(str,StartPoint,NumChars) & "%"
Else
msgbox "No numeric chars are displayed in ''"& str &"''."
End If
Thanks,
QTPKing.