help with numbers !

Discussion in 'ASP General' started by John Smith, Jun 30, 2003.

  1. John Smith

    John Smith Guest

    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
     
    John Smith, Jun 30, 2003
    #1
    1. Advertising

  2. John Smith

    Evertjan. Guest

    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"


    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Jun 30, 2003
    #2
    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. Subra
    Replies:
    25
    Views:
    1,195
    user923005
    Mar 8, 2007
  2. Andrew Tatum

    Fibonacci Numbers and Lucas Numbers

    Andrew Tatum, May 26, 2007, in forum: C++
    Replies:
    6
    Views:
    568
    Howard
    May 27, 2007
  3. Lance Hoffmeyer
    Replies:
    2
    Views:
    525
    Lance Hoffmeyer
    Jul 26, 2007
  4. jko170
    Replies:
    9
    Views:
    127
    jko170
    Jan 21, 2009
  5. GIMME
    Replies:
    5
    Views:
    188
    Thomas 'PointedEars' Lahn
    Jul 26, 2004
Loading...

Share This Page