Skip to content

A GoLang library to sort slices of strings in Natural Sort order

License

Notifications You must be signed in to change notification settings

wasim-nihal/gonatsort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gonatsort

A GoLang library to sort slices of strings in Natural Sort order and based on the numerical weightage.

Go Reference Build Security Check Go Report Card

Usage

  1. Get the package:

    go get github.com/wasim-nihal/gonatsort
  2. Import the package in the code

    package main
    
    import (
    	"fmt"
    	"sort"
    	"github.com/wasim-nihal/gonatsort"
    )
    
    func main() {
    	arr1 := []string{"bar2", "foo", "foo123", "foo2", "bar001"}
    	sort.Stable(gonatsort.NatSorter(arr1))
    	// Output: [bar001 bar2 foo foo2 foo123]
    	fmt.Println(arr1)
    }
    

License

This project is licensed under the Apache-2.0 license License. See the LICENSE file for details.

About

A GoLang library to sort slices of strings in Natural Sort order

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages