Results 1 to 4 of 4

Thread: SubString[Resolved]

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2004
    Posts
    70

    SubString[Resolved]

    i've got simple qns...


    My codes:
    For k=0 To 3

    Response.write(SubString("HAHA",k, 1))
    Response.write("<br>")
    next


    Error Encountered:
    Microsoft VBScript runtime (0x800A000D)
    Type mismatch: 'SubString'


    any idea whats wrong? Thanks!
    Last edited by velvetskies; Aug 16th, 2004 at 06:03 PM.

  2. #2
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877

    Re: SubString

    Originally posted by velvetskies
    i've got simple qns...


    My codes:
    For k=0 To 3

    Response.write(SubString("HAHA",k, 1))
    Response.write("<br>")
    next


    Error Encountered:
    Microsoft VBScript runtime (0x800A000D)
    Type mismatch: 'SubString'


    any idea whats wrong? Thanks!
    There is no function called SubString in ASP/VBScript. You can use "mid" function.

    From MSDN http://msdn.microsoft.com/library/de...l/vsfctmid.asp
    Visual Basic Scripting Edition

    Mid Function
    Returns a specified number of characters from a string.

    Mid(string, start[, length])
    Arguments
    string
    String expression from which characters are returned. If string contains Null, Null is returned.
    start
    Character position in string at which the part to be taken begins. If start is greater than the number of characters in string, Mid returns a zero-length string ("").
    length
    Number of characters to return. If omitted or if there are fewer than length characters in the text (including the character at start), all characters from the start position to the end of the string are returned.
    Remarks
    To determine the number of characters in string, use the Len function.

    The following example uses the Mid function to return six characters, beginning with the fourth character, in a string:

    VB Code:
    1. Dim MyVar
    2. MyVar = Mid("VBScript is fun!", 4, 6) ' MyVar contains "Script".
    Note The MidB function is used with byte data contained in a string. Instead of specifying the number of characters, the arguments specify numbers of bytes.
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Aug 2004
    Posts
    70

    thanks

    haha.. silly me.. got myself confused with java..
    its working now. thanks

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Add [Resolved]

Posting Permissions

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



Click Here to Expand Forum to Full Width