help with numbers !

J

John Smith

Hi,

I'm just trying to work out the postage costs for a shopping cart and for
some reason (possibly me being silly) i can't get the following to work :

Dim strWeight3, strWeight4
strWeight3 = "950"
If strWeight3<="1000" Then strWeight4="3.32" Else strWeight4="7.50"
Response.Write(strWeight3 & "&nbsp;/&nbsp;")
Response.Write(strWeight4)


So the weight's in Grammes, If it's over 1000g then the price is 7.50
otherwise it's 3.32.
The problem is this will only return the figure 7.50 for some reason
.................

Any pointers appreciated.

Thanks
 
E

Evertjan.

John Smith wrote on 30 jun 2003 in microsoft.public.inetserver.asp.general:
Just out of interest, i know that it won't work correctly if it was :

If intWeight3 <"1000" Then....

But why is this ?

comparing two strings alphabetically:

each character is compared by its ascii value,
and strings from left to right,
till there is a difference:

"9" < "A"

"A" < "a"

"8" > "1"

"abc1" < "abc2"

"adc1" > "abc1"

"bbb" > "abbb"

"800" > "1000"
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top