github.com/mymmsc/gox@v1.3.33/util/examples/sort/sort.go (about) 1 // Copyright (c) 2015, Emir Pasic. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package main 6 7 import "github.com/mymmsc/gox/util" 8 9 // SortExample to demonstrate basic usage of basic sort 10 func main() { 11 strings := []interface{}{} // [] 12 strings = append(strings, "d") // ["d"] 13 strings = append(strings, "a") // ["d","a"] 14 strings = append(strings, "b") // ["d","a",b" 15 strings = append(strings, "c") // ["d","a",b","c"] 16 util.Sort(strings, util.StringComparator) // ["a","b","c","d"] 17 }