Documentation ¶
Overview ¶
Package inmemory provides sorting algorithms for in-memory data.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SortSlice ¶
func SortSlice(input []string)
SortSlice sorts the given slice of strings ascendant. The given input will be modified after its call. To sort a slice of strings descendant, use SortSliceFunc.
Example ¶
package main import ( "fmt" "github.com/Code-Hex/dd" "github.com/KEINOS/go-sortfile/sortfile/inmemory" ) func main() { lines := []string{ "foo", "bar", "baz", } // Sort slices of strings. // For benchmark between other algorithms, see the benchmark_test.go. inmemory.SortSlice(lines) fmt.Println(dd.Dump(lines)) }
Output: []string{ "bar", "baz", "foo", }
func SortSliceFunc ¶
SortSliceFunc is similar to SortSlice but it takes a function to compare two strings. The given input will be modified after its call.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.