Connecting Tech Pros Worldwide Forums | Help | Site Map

problem with mid() function

Joeandtel
Guest
 
Posts: n/a
#1: Jul 19 '05
'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
Guest
 
Posts: n/a
#2: Jul 19 '05

re: problem with mid() function


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

Ray at work

"Joeandtel" <anonymous@discussions.microsoft.com> wrote in message
news:03f601c3aaf7$550327a0$a301280a@phx.gbl...[color=blue]
> '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?[/color]


Evertjan.
Guest
 
Posts: n/a
#3: Jul 19 '05

re: problem with mid() function


Joeandtel wrote on 14 nov 2003 in
microsoft.public.inetserver.asp.general:
[color=blue]
> '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?
>[/color]

<%

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.
Guest
 
Posts: n/a
#4: Jul 19 '05

re: problem with mid() function


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

var is j(ava)script, not vbscript
[color=blue][color=green]
>> 'convert to ascii
>> num = asc(str)
>> Response.Write num ' 65 shows up[/color][/color]

num is undefined
[color=blue][color=green]
>> '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?
>>[/color]
>
> <%
>
> response.write asc("h") &"<br>"
> response.write asc("hello") &"<br>"
>
> str="hello"
> response.write asc(str) &"<br>"
> s=mid(str,1,1)[/color]

str=mid(str,1,1) ' I mean
[color=blue]
> response.write asc(str) &"<br>"
>
> response.write asc(mid("hello",1,1)) &"<br>"
>
> %>
>
> gives:
>
> 104
> 104
> 104
> 104
> 104
>
> no error to be seen.
>[/color]



--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Closed Thread


Similar ASP / Active Server Pages bytes