Crystal: Compare 2 strings with versions

Hi, recently I faced a problem with my sotware because I need to compare versions stored as a String.

But I saw for example if I compare like that: “12.0.1” > “8.0”, crystal return false. I think it’s normal, but how can I compare properly versions ? Because some versions can be write like that as well: “alpha-12.0.1”

Any standards libraries for that ?

If the versions follow semver there is SemanticVersion - Crystal 1.7.2 within the stdlib. Otherwise guess you’d have to do some searching. Can’t think of any other options.

Related: Replace SemanticVersion · Issue #7637 · crystal-lang/crystal · GitHub