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



if there is any string in a given format like as "company name employeecode date" then we..

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

if there is any string in a given format like as "company name employeecode date" then we..

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

if there is any string in a given format like as "company name employeecode date" then we..

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

Post New Answer

More VB Script Interview Questions

Which object is used to work with the excel sheets in the vbscript language and what statement is used to create this object?

0 Answers  


Explain few date functions in vbscript?

0 Answers  


Can we create Crystal Report object in QTP?If yes then what it is and what are its various properties?

0 Answers  


How to replace junk code recorded by QTP with a mall function.

0 Answers  


Explain about the support of asp for vb script functionality?

0 Answers  






what is event handling?

0 Answers  


Can automation testing find ssame no. of bugs what we can find by manual testing?

0 Answers  


Could Anybody tell me the VBscript for REVERSE an Integer int reverse(int num) Ex:246 to 642

7 Answers   Amazon,


My Salary is 65000. How Much TDS I have to pay

0 Answers  


How you can call vbscript functions?

0 Answers  


What are the differences between sub procedures and function procedures?

0 Answers  


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

0 Answers  


Categories