Skip to content

Instantly share code, notes, and snippets.

@SmugZombie
Created July 13, 2016 23:47
Show Gist options
  • Select an option

  • Save SmugZombie/94cacbcf2720bb8453b73e07fd2e302e to your computer and use it in GitHub Desktop.

Select an option

Save SmugZombie/94cacbcf2720bb8453b73e07fd2e302e to your computer and use it in GitHub Desktop.
Compares Two Versions
VersionCompare(version1, version2)
{
StringSplit, verA, version1, .
StringSplit, verB, version2, .
Loop, % (verA0> verB0 ? verA0 : verB0)
{
if (verA0 < A_Index)
verA%A_Index% := "0"
if (verB0 < A_Index)
verB%A_Index% := "0"
if (verA%A_Index% > verB%A_Index%)
return 1
if (verB%A_Index% > verA%A_Index%)
return 2
}
return 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment