problem with mid() function

Discussion in 'ASP General' started by Joeandtel, Nov 14, 2003.

  1. Joeandtel

    Joeandtel Guest

    'When I create a single character string
    var str = "A"
    'convert to ascii
    num = asc(str)
    Response.Write num ' 65 shows up
    'when I have a whole string
    str = "hello"
    str = mid(str, 1, 1) ' return 'h'
    num = asc(str)
    'I get an error:
    Invalid procedure call or argument: 'asc'
    What can be done to fix this?
     
    Joeandtel, Nov 14, 2003
    #1
    1. Advertising

  2. Joeandtel

    Ray at Guest

    What language are you using here? It looks like it's half jscript, half
    vbscript.

    Ray at work

    "Joeandtel" <> wrote in message
    news:03f601c3aaf7$550327a0$...
    > 'When I create a single character string
    > var str = "A"
    > 'convert to ascii
    > num = asc(str)
    > Response.Write num ' 65 shows up
    > 'when I have a whole string
    > str = "hello"
    > str = mid(str, 1, 1) ' return 'h'
    > num = asc(str)
    > 'I get an error:
    > Invalid procedure call or argument: 'asc'
    > What can be done to fix this?
     
    Ray at, Nov 14, 2003
    #2
    1. Advertising

  3. Joeandtel

    Evertjan. Guest

    Joeandtel wrote on 14 nov 2003 in
    microsoft.public.inetserver.asp.general:

    > 'When I create a single character string
    > var str = "A"
    > 'convert to ascii
    > num = asc(str)
    > Response.Write num ' 65 shows up
    > 'when I have a whole string
    > str = "hello"
    > str = mid(str, 1, 1) ' return 'h'
    > num = asc(str)
    > 'I get an error:
    > Invalid procedure call or argument: 'asc'
    > What can be done to fix this?
    >


    <%

    response.write asc("h") &"<br>"
    response.write asc("hello") &"<br>"

    str="hello"
    response.write asc(str) &"<br>"
    s=mid(str,1,1)
    response.write asc(str) &"<br>"

    response.write asc(mid("hello",1,1)) &"<br>"

    %>

    gives:

    104
    104
    104
    104
    104

    no error to be seen.

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Nov 14, 2003
    #3
  4. Joeandtel

    Evertjan. Guest

    Evertjan. wrote on 14 nov 2003 in
    microsoft.public.inetserver.asp.general:

    > Joeandtel wrote on 14 nov 2003 in
    > microsoft.public.inetserver.asp.general:
    >
    >> 'When I create a single character string
    >> var str = "A"


    var is j(ava)script, not vbscript

    >> 'convert to ascii
    >> num = asc(str)
    >> Response.Write num ' 65 shows up


    num is undefined

    >> 'when I have a whole string
    >> str = "hello"
    >> str = mid(str, 1, 1) ' return 'h'
    >> num = asc(str)
    >> 'I get an error:
    >> Invalid procedure call or argument: 'asc'
    >> What can be done to fix this?
    >>

    >
    > <%
    >
    > response.write asc("h") &"<br>"
    > response.write asc("hello") &"<br>"
    >
    > str="hello"
    > response.write asc(str) &"<br>"
    > s=mid(str,1,1)


    str=mid(str,1,1) ' I mean

    > response.write asc(str) &"<br>"
    >
    > response.write asc(mid("hello",1,1)) &"<br>"
    >
    > %>
    >
    > gives:
    >
    > 104
    > 104
    > 104
    > 104
    > 104
    >
    > no error to be seen.
    >




    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Nov 14, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. MarkD
    Replies:
    0
    Views:
    756
    MarkD
    Dec 4, 2003
  2. MJB
    Replies:
    0
    Views:
    322
  3. bruce barker
    Replies:
    2
    Views:
    374
    bruce barker
    Aug 23, 2004
  4. Ken VdB

    Mid() function crippled?

    Ken VdB, Apr 2, 2004, in forum: ASP General
    Replies:
    10
    Views:
    329
    Joe Earnest
    Apr 4, 2004
  5. Connell Gauld

    Equivalent of the Mid function from VB?

    Connell Gauld, May 24, 2004, in forum: Perl Misc
    Replies:
    4
    Views:
    246
    Tore Aursand
    May 24, 2004
Loading...

Share This Page