Back to godoc.org

Package xstrings

v0.0.0-...-3cf7f3f
Latest Go to latest

The latest major version is .

Published: May 27, 2020 | License: GPL3 | Module: lab.nexedi.com/kirr/go123

Overview

Package xstrings provides addons to standard package strings.

Index

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