github.com/wangyougui/gf/v2@v2.6.5/os/gfile/gfile_z_example_sort_test.go (about) 1 // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. 2 // 3 // This Source Code Form is subject to the terms of the MIT License. 4 // If a copy of the MIT was not distributed with this file, 5 // You can obtain one at https://github.com/wangyougui/gf. 6 7 package gfile_test 8 9 import ( 10 "fmt" 11 12 "github.com/wangyougui/gf/v2/os/gfile" 13 ) 14 15 func ExampleSortFiles() { 16 files := []string{ 17 "/aaa/bbb/ccc.txt", 18 "/aaa/bbb/", 19 "/aaa/", 20 "/aaa", 21 "/aaa/ccc/ddd.txt", 22 "/bbb", 23 "/0123", 24 "/ddd", 25 "/ccc", 26 } 27 sortOut := gfile.SortFiles(files) 28 fmt.Println(sortOut) 29 30 // Output: 31 // [/0123 /aaa /aaa/ /aaa/bbb/ /aaa/bbb/ccc.txt /aaa/ccc/ddd.txt /bbb /ccc /ddd] 32 }