Skip to content

Latest commit

 

History

History
29 lines (20 loc) · 822 Bytes

README.md

File metadata and controls

29 lines (20 loc) · 822 Bytes

Custom Sort Go (CS:GO)

csgo300

Aside from my punny acronym, this library is to have a collection of custom applications of the sort package and other sorting algorithms.

Use

Pure Package

To prevent mutations of the original slice, I created a package that returns a new sorted or reverse sorted slice.

Example

package main

import (
	"fmt"
	csgo "github.com/cpustejovsky/customsortgo/pure"
)

func main() {
	list := []string{"cat", "albatross", "dolphin", "bee", "zebra", "aardvark"}
	sorted := csgo.NewSortedStrings(list)
	fmt.Println(list)   // [cat albatross dolphin bee zebra aardvark]
	fmt.Println(sorted) // [aardvark albatross bee cat dolphin zebra]
}