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

Hai this is sheik, i want to learn VB scripts for web application pls guide me what are all basic things need to know to learn VB scripts in web application.

0 Answers  


write a qtp script to count the number of minimized windows

1 Answers  


what is the purpose of the Reporter.ReportEvent in QTP and also please give the brief description about Reporter.ReportEvent ?

4 Answers   CybAge,


How to Enter Values on the Command promt using VB script

0 Answers  


explain with example primitive data types of vb script.

1 Answers  


can u test the application without add-in?

1 Answers  


I need help to write a function in vbscript to click on a link. That link looks like a tab. There are 6 tabs. When I click on 1 tab it should show as "on". when I spy the class property is on. But for the one which is not clicked the class property is blank. I have objects created in our custom object repository. Please give me some idea.

1 Answers  


How can you fetch the value of a cookie?

0 Answers  


create a form to accept username and password validate the username and password with using message box, display the corresponding user message

0 Answers   CSC,


Explain the arrays in vb script?

0 Answers  


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  


What is the scope of a constant declared using public?

0 Answers  


Categories