stringutil

package
v1.4.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2020 License: MIT Imports: 2 Imported by: 1

Documentation

Overview

Package stringutil adds functions for working with strings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fields added in v1.1.0

func Fields(s, sep string) []string

Fields slices s in to all substrings separated by sep. Leading/trailing whitespace and empty elements will be removed.

e.g. "a;b", "a; b", " a ; b", and "a; b;" will all result in {"a", "b"}.

func GetLine

func GetLine(in string, n int) string

GetLine gets the nth line \n-denoted line from a string.

func Left

func Left(s string, n int) string

Left returns the "n" left characters of the string.

If the string is shorter than "n" it will return the first "n" characters of the string with "…" appended. Otherwise the entire string is returned as-is.

func LowerFirst

func LowerFirst(s string) string

LowerFirst transforms the first character to lower case, leaving the rest of the casing alone.

func RemoveUnprintable

func RemoveUnprintable(s string) string

RemoveUnprintable removes unprintable characters (0 to 31 ASCII) from a string.

func UpperFirst

func UpperFirst(s string) string

UpperFirst transforms the first character to upper case, leaving the rest of the casing alone.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL