Skip to content

Latest commit

 

History

History
24 lines (19 loc) · 618 Bytes

README.md

File metadata and controls

24 lines (19 loc) · 618 Bytes

🍌split

Bananasplit is a simple library to split strings by Unicode code-point ranges.

Example

package main

import (
	"fmt"

	"github.com/tachiniererin/bananasplit"
)

func main() {
	// define only the emoji range, to split by emoji sequences
	// and everything else
	r := map[string][]bananasplit.RuneRange{
		"emoji": bananasplit.EmojiRange,
	}
	s := "tachiniererin🏳️‍🌈🏳️‍⚧️ emoji splitting"
	fmt.Printf("%+v", bananasplit.SplitByRanges(s, r))
}