gitee.com/quant1x/gox@v1.21.2/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 (
     8  	"gitee.com/quant1x/gox/util/internal"
     9  )
    10  
    11  // SortExample to demonstrate basic usage of basic sort
    12  func main() {
    13  	strings := []interface{}{}                        // []
    14  	strings = append(strings, "d")                    // ["d"]
    15  	strings = append(strings, "a")                    // ["d","a"]
    16  	strings = append(strings, "b")                    // ["d","a",b"
    17  	strings = append(strings, "c")                    // ["d","a",b","c"]
    18  	internal.Sort(strings, internal.StringComparator) // ["a","b","c","d"]
    19  }