PDA

View Full Version : ASP code


Nix
01-30-2004, 09:14 AM
Hey guys, i got a weired problem.

dim txt as String
txt = "abc"
dim last as Char
last = txt.char(txt.length-1)
response.write last

i want to get the last char of txt but i always get this error.

Microsoft VBScript compilation error '800a0401'
Expected end of statement
/prod.asp, line 66
dim txt as String

can anyone enlighten me why?
Sorry i just started asp last month..

glenngv
01-30-2004, 09:24 AM
In classic ASP, all variables are of the type variant.
You don't have to specify the data type.

dim txt, last
txt = "abc"
last = Right(txt, 1)
response.write last