Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jan 2003
    Posts
    111
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Question What is the ASP equivalant of Substr

    I am having trouble breaking apart a variable into shorter segments. Since there are no delimiters I can't use a Split or at least don't know how to.

    The variable is a tracking number which also contains a date - so I want to pull the date out for another use.

    So here is an example variable:
    200592915368

    I want an end result of:
    9/29/2005 (or something similar)

    Using cgi I would just substr the varibale into three chunks and recombine - how do I do the same in ASP?

    (Additional note - the month will sometimes be 2 digits instead of 1 but I'm sure I can add in that If statement once I learn how to break apart the variable.)

    Thanks in advance for an suggestions.

  • #2
    Smokes a Lot
    Join Date
    Jul 2003
    Location
    CA, USA
    Posts
    1,594
    Thanks
    5
    Thanked 20 Times in 20 Posts
    The following example uses the Mid function to return six characters, beginning with the fourth character, in a string:

    Code:
    Dim MyVar
    MyVar = Mid("VBScript is fun!", 4, 6) ' MyVar contains "Script".
    Hope that helps,
    Basscyst
    Helping to build a bigger box. - Adam Matthews

  • #3
    Regular Coder
    Join Date
    Jan 2003
    Posts
    111
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Cool Fantastic!!

    Ah, the ease of the Mid, Left, Right and Len String Functions.

  • #4
    Regular Coder hinch's Avatar
    Join Date
    Sep 2005
    Location
    UK
    Posts
    923
    Thanks
    25
    Thanked 80 Times in 80 Posts
    theres an instr function but dont know how much use to you it'd be


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •