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.

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is used of Property........End Property loop ? how to write the script for it?

1684


What is the use of the instr function?

579


Mention what if you do not specify anything when you call a procedure?

570


Hello Guys, If any body looking for "worksoft certify tool training in bangalore", please contact me aimansaud@gmail.com

1045


I want to run QTP script on Linux server is it possible to do this by connecting Windows to Linux through VPN/Terminal Server and just run the script on Linux server.

1786






what is the object hyrarchy in QTP for a web based application

1881


How to delete a cookie using vbscript?

551


Which data type/types are supported by vbscript language and what are their specialties?

592


How will you get a combined string from array of string in vbscript?

545


how to answer "TELL ME ABOUT UR SELF" as exp.person. whr to start and whr to stop. can anyone tel me

1339


if u ve resrevation for train and u get a number supose 1234xxxokie.after sucessul entering all required fields. now u put that number in search and want to chk wether these ar same or not if both ar same then its okie otherwise test fail.what would be the vb script code for it to compare these two values of different page.

1442


Which keyword is used to declare a variable in the vbscript language?

529


Which function is used in the vbscript language to convert the specified expression into a date type value?

520


How to Import data from a file (file is on the desktop) to the data table

1556


When are redim statement and preserve keyword used in the vbscript language?

591