strings2

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2015 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(s1, s2 string) int

Compare compare two string, if equal, 0 was returned, if s1 > s2, 1 was returned, otherwise -1 was returned

func Filter

func Filter(matcher func(string) bool, strings ...string) []string

Filter strings matched by matcher

func IndexN

func IndexN(str, sep string, n int) (index int)

IndexN find index of n-th sep string

func IndexNonSpace

func IndexNonSpace(s string) int

IndexNonSpace find index of first non-space character, if not exist, -1 was returned

func IsAllCharsIn

func IsAllCharsIn(s, encoding string) bool

IsAllCharsIn check whether all chars of string is in encoding string

func IsEmpty

func IsEmpty(s string) bool

func IsNotEmpty

func IsNotEmpty(s string) bool

func JoinInt

func JoinInt(v []int, sep string) string

JoinInt join int slice as string

func JoinUint

func JoinUint(v []uint, sep string) string

JoinInt join int slice as string

func LastIndexByte

func LastIndexByte(s string, b byte) int

func LastIndexN

func LastIndexN(str, sep string, n int) (index int)

LastIndexN find last index of n-th sep string

func LastIndexNonSpace

func LastIndexNonSpace(s string) int

LastIndexNonSpace find index of last non-space character, if not exist, -1 was returned

func Map

func Map(mapper func(string) string, strings ...string) []string

Map convert string using the mapper

func MergeSpace

func MergeSpace(s string, trim bool) string

MergeSpace merge mutiple space to one, trim determin whether remove space at prefix and suffix

func MidIndex

func MidIndex(s string, sep byte) int

MidIndex find middle seperator index of string, not first and last

func NumMatched

func NumMatched(matcher func(string) bool, strings ...string) int

NumMatched return number of strings matched by matcher

func RemoveSpace

func RemoveSpace(s string) string

RemoveSpace remove all space characters from string by unibyte.IsSpace

func RepeatJoin

func RepeatJoin(s, sep string, count int) string

RepeatJoin repeat s count times as a string slice, then join with sep

func Seperate

func Seperate(s string, sep byte) (string, string)

Seperate string by seperator, the seperator must in the middle of string, not first and last

func SplitAndTrim

func SplitAndTrim(s, sep string) []string

TrimSplit split string and return trim space string

func SuffixJoin

func SuffixJoin(s []string, suffix, sep string) string

SuffixJoin join string slice with suffix

func ToAbridge

func ToAbridge(str string) string

ToAbridge extract first letter and all upper case letter from string as it's abridge case

func ToCamel

func ToCamel(s string) string

ToCamel string, xx_yy to XxYy, xx__yy to Xx_Yy xx _yy to Xx Yy, the rule is that a lower case letter after '_' will combine to a upper case letter

func ToLowerAbridge

func ToLowerAbridge(str string) (s string)

ToLowerAbridge extract first letter and all upper case letter from string as it's abridge case, and convert it to lower case

func ToSnake

func ToSnake(s string) string

ToSnake string, XxYy to xx_yy, X_Y to x_y

func TrimAfter

func TrimAfter(s, delimiter string) string

TrimAfter trim string and remove the section after delimiter and delimiter itself

func TrimAndToLower

func TrimAndToLower(str string) string

TrimAndToLower return the trim and lower format of a string

func TrimAndToUpper

func TrimAndToUpper(str string) string

TrimAndToUpper return the trim and upper format of a string

func TrimBefore

func TrimBefore(s, delimeter string) string

func TrimQuote

func TrimQuote(str string) (string, bool)

TrimQuote trim quote for string, return error if quote don't match

func TrimWrap

func TrimWrap(str, left, right string, strict bool) (string, bool)

func WriteStringsToBuffer

func WriteStringsToBuffer(buffer *bytes.Buffer, strings []string, sep string)

WriteStringsToBuffer write strings to buffer, it avoid memory allocaton of join strings

Types

This section is empty.

Jump to

Keyboard shortcuts

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