if there is any string in a given format like as "company
name employeecode date" then we have to fetch employeecode
form string
for ex-string is "capgemini12345june2013" then we have to
fetch 12345 by using vb script so guys how can we do that
please reply it.
Answers were Sorted based on User's Feedback
Answer / suman
Str = "capgemini12345une2013"
Dim i, j
For i = 1 to Len(Str)
If isnumeric(Mid(Str, i, 1)) Then
Exit For
End If
Next
MsgBox i
For j = i to Len(Str)
If not isnumeric(Mid(Str, j, 1)) Then
Exit For
End If
Next
MsgBox j
MsgBox Mid(Str, i, (j - i))
Is This Answer Correct ? | 5 Yes | 0 No |
Answer / abhijit bongale
Option Explicit
Dim Str : Str = "capgemini12345june2013"
Dim i, j
For i = 1 to Len(Str)
If Asc(Mid(Str, i, 1)) >= 48 AND Asc(Mid
(Str, i, 1)) <= 57 Then
Exit For
End If
Next
MsgBox i
For j = i to Len(Str)
If (Asc(Mid(Str, j, 1)) >= 65 AND Asc(Mid
(Str, j, 1)) <= 90) OR (Asc(Mid(Str, j, 1)) >= 97 AND Asc
(Mid(Str, j, 1)) <= 122) Then
Exit For
End If
Next
MsgBox j
MsgBox Mid(Str, i, (j - i))
Set Str = Nothing
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / sriraja
str="capgemini12345june2016"
strsplit=split(str,"june")
convstr=cstr(strsplit(0))
for i=1 to len(convstr)
strmid=mid(convstr,i,1)
if isnumeric(strmid)=true Then
temp=temp&strmid
End if
Next
Print temp
Is This Answer Correct ? | 0 Yes | 0 No |
Which object is used to work with the excel sheets in the vbscript language and what statement is used to create this object?
Explain few date functions in vbscript?
Can we create Crystal Report object in QTP?If yes then what it is and what are its various properties?
How to replace junk code recorded by QTP with a mall function.
Explain about the support of asp for vb script functionality?
what is event handling?
Can automation testing find ssame no. of bugs what we can find by manual testing?
Could Anybody tell me the VBscript for REVERSE an Integer int reverse(int num) Ex:246 to 642
My Salary is 65000. How Much TDS I have to pay
How you can call vbscript functions?
What are the differences between sub procedures and function procedures?
Hellow friends, I am learning QTP,but here problem is VB script. please guide me how to learn VB script w.r.t QTP and if you know any books tell me or if you have any materials or any use full material or any else w.r.t QTP please post me p.p.sekhar