Results 1 to 3 of 3

Thread: Newbie questioon: String Comparison

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2000
    Posts
    72

    Question

    Ok, after looking on MSDN and doing some test of my own, I have no idea how to make this work.

    Basically, I have 2 strings which being compared. Now my problem is that they are the string representation of integers. For example: the Number 8 as "8". Ok obvious i know.

    So I want to sort an array I have and unfortunately I am locked into havin the elements as Strings. So when I go to sort the array from these integer strings... it doesn't compare properly:
    i.e. "45" < "5"

    StrComp appears to just allow you to compare with binary or text... but both of these options give the same result in this instance.

    So is there an easy (maybe built in way) to convert these integer strings to integers and THEN compare them?? Maybe someone knows an even easier way.

    Thanx in advance,
    cLocKwOrk

  2. #2
    Fanatic Member gwdash's Avatar
    Join Date
    Aug 2000
    Location
    Minnesota
    Posts
    666
    Sure, use the Val() built in function, or the CInt() built in function.
    GWDASH
    [b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Oct 2000
    Posts
    72

    Talking

    SWEEEEEEEET. Worked beautifully. THANX!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width