Sort a list of object identifiers: Difference between revisions
→{{header|Ruby}}: added example using Gem::Version
(→{{header|Ruby}}: added example using Gem::Version) |
|||
Line 1,165:
1.3.6.1.4.1.11150.3.4.0.1
</pre>
Or, using the Gem module (which knows about versions):
<lang ruby>puts %w[
1.3.6.1.4.1.11.2.17.19.3.4.0.10
1.3.6.1.4.1.11.2.17.5.2.0.79
1.3.6.1.4.1.11.2.17.19.3.4.0.4
1.3.6.1.4.1.11150.3.4.0.1
1.3.6.1.4.1.11.2.17.19.3.4.0.1
1.3.6.1.4.1.11150.3.4.0
]
.sort_by{|oid| Gem::Version.new(oid) }</lang>
with identical output.
=={{header|Sidef}}==
|