Back to

Package xstrings

Latest Go to latest

The latest major version is .

Published: May 27, 2020 | License: GPL3 | Module:


Package xstrings provides addons to standard package strings.


func HeadTail

func HeadTail(s, sep string) (head, tail string, err error)

HeadTail splits string into head & tail.

(head+sep+tail) -> head, tail.

Note: tail may contain sep.

func Split2

func Split2(s, sep string) (s1, s2 string, err error)

Split2 splits string by sep and expects exactly 2 parts.

func SplitLines

func SplitLines(s, sep string) []string

SplitLines splits string into lines.

The last line, if it is empty, is omitted from the result. (rationale is: string.Split("hello\nworld\n", "\n") -> ["hello", "world", ""])

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier