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 |
Am working with web application. i faced one senario. i.e, webpage having webtable having two coloumns, in that first coloumn is for serial no and second coloumn is for mac address link, now i want to get first row second coloumn value, that having macaddress as link. Please help me how to get that link?
Mention what is the difference between vbscript and vba?
Inorder to avoid Message box while writing script which alternative method can be used?
write a vb script to display the code "vbscripting" alphabet by alphabet(i e 1st v then b and up to g)
what is inner join? what is outer join? what is a constraint? tell me about rdbms? tell me about acid properties?
Write a VB Script to count blank Lines in a notepad
What are class properties?
What is the purpose of the err object in the vbscript language?
How are arrays declared in the vbscript language?
what is fire event method in qtp?
How to write VB script for login module?
How are values assigned to the variables in the vbscript language?