Sort a list of object identifiers: Difference between revisions
Content added Content deleted
(Added Wren) |
|||
Line 1,834: | Line 1,834: | ||
bubbleSort a |
bubbleSort a |
||
wscript.echo join(a,vbCrlf) </lang> |
wscript.echo join(a,vbCrlf) </lang> |
||
{{out}} |
|||
<pre> |
|||
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.1 |
|||
1.3.6.1.4.1.11.2.17.19.3.4.0.4 |
|||
1.3.6.1.4.1.11.2.17.19.3.4.0.10 |
|||
1.3.6.1.4.1.11150.3.4.0 |
|||
1.3.6.1.4.1.11150.3.4.0.1 |
|||
</pre> |
|||
=={{header|Wren}}== |
|||
{{libheader|Wren-fmt}} |
|||
{{libheader|Wren-sort}} |
|||
<lang ecmascript>import "/fmt" for Fmt |
|||
import "/sort" for Sort |
|||
var oids = [ |
|||
"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" |
|||
] |
|||
oids = oids.map { |oid| Fmt.v("s", 5, oid.split("."), 0, ".", "") }.toList |
|||
Sort.quick(oids) |
|||
oids = oids.map { |oid| oid.replace(" ", "") }.toList |
|||
System.print(oids.join("\n"))</lang> |
|||
{{out}} |
{{out}} |
||
<pre> |
<pre> |