Jump to content
Xtreme .Net Talk

How to compare if "1.20.0" is greater then "1.3.10"? [CS/C# 2003]


Recommended Posts

Posted

I have 2 strings (sOldVersion & sNewVersion) that have the form xxx.xxx.xxx (3 sections) ... for example:

1.2.3

1.10.33

2.1.15

7.80.1

These correspond to VERSIONS of one of our components (and they are retireved a strings in-code).

My problem is I need to determine if "sNewVersion" is greater, equal, or less then "sOlderVersion" ... and I can't just cast these as integers (obviouslly)...

 

Anyone have a clue how I could accomplish such a comparaison?

One solution I thought of (but have not yet implemented) would be to break down each version section (high, med, low), cast them as integers, and compare like that (I am sure I can get it to work, but is there a nicer way to do this?)

 

Any help, hints, or ideas would be greatly appreciated.

Thanks,

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...