Go Package sort: Difference between revisions
Jump to navigation
Jump to search
(Created page with "=External= * https://golang.org/pkg/sort/ =Internal= * Standard Library") |
|||
(7 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
=External= | =External= | ||
* https://pkg.go.dev/sort | |||
* https://pkg.go.dev/slices | |||
* | =Internal= | ||
* [[Go_Language_Modularization#sort|Standard library]] | |||
= | =Overview= | ||
The package provides primitives for sorting slices of ints and floats and user-defined collections. | |||
<font color=darkkhaki> | |||
The <code>sort</code> package. | |||
<syntaxhighlight lang='go'> | |||
sort.Ints(slice) | |||
sort.Float64s(slice) | |||
sort.Strings(slice) | |||
</syntaxhighlight> | |||
</font> | |||
To sort slices, <code>slices.Sort*</code> is preferred. | |||
=Slice Sorting= | |||
{{Internal|Go Slice Sorting#Overview|Slice Sorting}} |
Latest revision as of 03:09, 13 June 2024
External
Internal
Overview
The package provides primitives for sorting slices of ints and floats and user-defined collections.
The sort
package.
sort.Ints(slice)
sort.Float64s(slice)
sort.Strings(slice)
To sort slices, slices.Sort*
is preferred.