Community discussion forum

How to determine who is at a higher version [VC++6]

  • 7 months ago
    I am trying to find a way to compare two versions that are stored in a text file, specifically I extract them both (as strings) and compare using standard operations (<, >, =<, =>, ==) - most of the time this works but I've just encountered a case that outright fails. For example: 1 < 5 2a > 1b 75a > 54 92c > 92a These all seem to work fine ... but then I just got this case 113 < 90A (which is absolutly wrong, 113 is greater then 90A not less then) So, I guess using the standard operators on my strings was a pretty bad idea - now I need to come up with an alternative. The version is always NUMERICAL followed potentially by ALPHA characters (90, 113a, 113A, 75b, 22, etc...), no other format is acceptable. I was thinking of extracting the numerical numbers and comparing them (can I use standard string operators for this?), and then if they are equal extract the ALPHA characters and compare them ... a) seems like a pain, is this really the best/right way to go about it? b) I've got really not much of a clue how to implement this checking function, is there something in C++ that allows you to easily split the string into both components and then somehow compare them? Any help, hints, or ideas would be much appreciated... Thanks,
    Post was edited on 06/04/2009 21:05:21 Report abuse

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

We'd love to hear what you think! Submit ideas or give us feedback