stringshelper

package module
v0.0.0-...-f9627e9 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2016 License: Apache-2.0 Imports: 2 Imported by: 2

README

stringshelper

Helpers for GoLang package "strings".

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Len

func Len(s string) (l int)

Len returns number of glyph in UTF-8 encoded string.

func PadLeft

func PadLeft(s, glyph string, l int) string

PadLeft returns original string padded on the left side with glyph to length l. Length for this function is in glyphs, not bytes or runes. Passed glyph should be single glyph (printable char) else result will be of wrong length. But where is no check for that.

func PadLeftWithByte

func PadLeftWithByte(s string, b byte, l int) string

PadLeftWithBytes return original string padded on the left side with char b to length l. Length for this function is in bytes. So this function is good only for ascii strings.

func PadRight

func PadRight(s, glyph string, l int) string

PadRight returns original string padded on the right side with glyph to length l. Length for this function is in glyphs, not bytes or runes. Passed glyph should be single glyph (printable char) else result will be of wrong length. But where is no check for that.

func PadRightWithByte

func PadRightWithByte(s string, b byte, l int) string

PadRightWithBytes return original string padded on the left side with char b to length l. Length for this function is in bytes. So this function is good only for ascii strings.

func TrimBytes

func TrimBytes(s string, cut byte) string

func TrimLeftBytes

func TrimLeftBytes(s string, cut byte) string

func TrimRightBytes

func TrimRightBytes(s string, cut byte) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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