Forum Moderators: open

Message Too Old, No Replies

Character Length Recognition

         

cmatcme

8:17 pm on Mar 8, 2005 (gmt 0)

10+ Year Member



I am getting people to subscribe to my website. In order to do this they have to fill in a form. Their username and password has to be up to 15 characters long.

The only trouble is, recognizing the character length. I tried using cint before remembering that is for determining the value of a number, not the length of a series of characters.

So, I'm slightly puzzled.

ASP under-achiever of the year//

cmatcme

CaseyRyan

8:36 pm on Mar 8, 2005 (gmt 0)

10+ Year Member



I believe you want the Len() [msdn.microsoft.com] function. It returns an integer value equivalent to the length of the string.

-=casey=-

cmatcme

6:22 pm on Mar 9, 2005 (gmt 0)

10+ Year Member



I've found that and tested it and it works

Trouble is:

If Len(request("visitor"))<=3 AND Len(request("visitor"))=>7 Then
response.write "Valid visitor"
Else
response.write "Invalid visitor"
End If
... doesn't appear to work.

Invalid visitor always comes up.

Would I have to use

cint(Len(request("visitor")))<=3

?

defanjos

6:38 pm on Mar 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think you have your "<" and ">" mixed up. It should be:

If Len(request("visitor"))=>3 AND Len(request("visitor"))=<7 Then

This will accept lenghts from 3 to 7

cmatcme

4:06 pm on Mar 10, 2005 (gmt 0)

10+ Year Member



ooWayyy! Thanks guys!

It works \\

cmatcme

4:33 pm on Mar 10, 2005 (gmt 0)

10+ Year Member



OK something else.

I've got a form function where users enter their name.
That function then checks whether their name IsNumric.

Here it is:

If IsNumeric(request("full"))

Is there an opposite functio ie:

If IsNotNumeric(request("full"))

Thanks \\

ebound

4:37 pm on Mar 10, 2005 (gmt 0)

10+ Year Member



try

If Not IsNumeric(request("full")) then

ebound

4:38 pm on Mar 10, 2005 (gmt 0)

10+ Year Member



try

If Not IsNumeric(request("full")) then

cmatcme

6:00 pm on Mar 10, 2005 (gmt 0)

10+ Year Member



Thanks ebound!