how to split tha varchar input from user

Author Message
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)
0
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
 
#1
    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)
    0
    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


     
    #2
      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)
      0

      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
       
      #3
        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)
        0
        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

         
        #4
          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)
          0
          thamks 4 the healp


          can u tell me how to write javascript code inside vbscript code

          rply as early as possible
           
          #5
            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)
             
            #6

              Online Bookmarks Sharing: Share/Bookmark

              Jump to:

              Current active users

              There are 0 members and 1 guests.

              Icon Legend and Permission

              • New Messages
              • No New Messages
              • Hot Topic w/ New Messages
              • Hot Topic w/o New Messages
              • Locked w/ New Messages
              • Locked w/o New Messages
              • Read Message
              • Post New Thread
              • Reply to message
              • Post New Poll
              • Submit Vote
              • Post reward post
              • Delete my own posts
              • Delete my own threads
              • Rate post

              2000-2012 ASPPlayground.NET Forum Version 3.9