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

how to write code: to check whether the window of an Application Under Test exist or not . plz give with example

2 Answers  


write generic functions for webapplication?like generic function for webedit generic function for webbutton generic function for links

1 Answers  


Which conditional statement is the most convenient one to use in the case of multiple conditions in the vbscript language?

0 Answers  


Write a program to print all lines that contains a word either “testing” or “qtp”

2 Answers  


Which in-built function is used to format the number in the vbscript language?

0 Answers  






Can u describe what kind of testing are for OTC derivates by banks.

0 Answers   BoA,


what does create object actually do when you call it in vbscript?

1 Answers   Cap Gemini,


What is the use of the recordset object and which statement is used to create such an object?

0 Answers  


how to retrive the tooltip by using descriptive programming in qtp?

3 Answers   iGate,


What are the environments supported by vbscript language?

0 Answers  


Hi anyone Can Send Solution to the Question wt m posting now Prepare Script for the Bellow Scenario? Login to Gmail Page Open Inbox check Mails save them in a Folder

0 Answers   IBM,


Write a test case using Test if the images,a particular test exists,check if the page links match,page response is within a certain range,parameterization of the test,the test should comprise of actions,the test should use a custom function,the test should use global repository

0 Answers  


Categories