aloktiwari
-
Total Posts
:
3
- Scores: 0
-
Reward points
:
0
- Joined: 7/9/2008
-
Status: offline
|
how to split tha varchar input from user
Wednesday, July 09, 2008 10:14 PM
( permalink)
hi all i m alok tiwari i m workin on VBSCRIPT i have user input AS "20yrs 2mnth" how to get that 20 and 2 saperatelly using VB script i want to get 20 year and 2 month saperatelly coz i have to add that witha another date so any body can healp me doin this using Javascript or vbscript thanking you
|
|
|
|
ehvbs
-
Total Posts
:
3321
- Scores: 110
-
Reward points
:
0
- Joined: 6/22/2005
- Location: Germany
-
Status: offline
|
RE: how to split tha varchar input from user
Wednesday, July 09, 2008 11:00 PM
( permalink)
Hi aloktiwari, use a regular expression like this: >> Dim oRE : Set oRE = New RegExp >> oRE.Pattern = "\d+" >> oRE.Global = True >> Dim sTest : sTest = "20yrs 2mnth" >> Dim oMTS : Set oMTS = oRE.Execute( sTest ) >> Dim oMT >> For Each oMT in oMTS >> WScript.Echo oMT.Value >> Next >> 20 2 >> Good luck! ehvbs
|
|
|
|
aloktiwari
-
Total Posts
:
3
- Scores: 0
-
Reward points
:
0
- Joined: 7/9/2008
-
Status: offline
|
RE: how to split tha varchar input from user
Thursday, July 10, 2008 2:39 AM
( permalink)
thanks a lot for the healp wt is "WScript" coz whene i m runnign this code it's saying "object required near WScript can u explin me that
|
|
|
|
ehvbs
-
Total Posts
:
3321
- Scores: 110
-
Reward points
:
0
- Joined: 6/22/2005
- Location: Germany
-
Status: offline
|
RE: how to split tha varchar input from user
Thursday, July 10, 2008 6:34 AM
( permalink)
Hi aloktiwari, "WScript.Echo" is a way to output data for use in standalone VBS scripts; think of it as a kind of Response.Write (not entirely sure about that - I don't do ASP). The important part of my posting was/is the regular expression. >> Dim oMT >> For Each oMT in oMTS >> WScript.Echo oMT.Value >> Next ==> >> Dim oMT, nNumber >> For Each oMT in oMTS >> nNumber = CLng( oMT.Value ) >> Next Better luck! ehvbs
|
|
|
|
aloktiwari
-
Total Posts
:
3
- Scores: 0
-
Reward points
:
0
- Joined: 7/9/2008
-
Status: offline
|
RE: how to split tha varchar input from user
Friday, July 11, 2008 11:36 PM
( permalink)
thamks 4 the healp can u tell me how to write javascript code inside vbscript code rply as early as possible
|
|
|
|
webber123456
-
Total Posts
:
58
- Scores: 0
-
Reward points
:
0
- Joined: 9/20/2007
-
Status: offline
|
RE: how to split tha varchar input from user
Monday, July 14, 2008 2:18 AM
( permalink)
|
|
|
|