strings2

package
v0.0.0-...-60b0ebe Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const ErrQuoteNotMatch = errors.Err("Quote don't match")

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 IsAllCharsIn

func IsAllCharsIn(s, encoding string) bool

IsAllCharsIn check whether all chars of string is in encoding string

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 MidIndex

func MidIndex(s string, sep byte) int

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

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 SplitAtLastN

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

SplitAtLastN find last index of n-th sep string

func SplitAtN

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

SplitAtN find index of n-th sep string

func SuffixJoin

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

SuffixJoin join string slice with suffix

func ToAbridge

func ToAbridge(str string) (s 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 string, delimiter string) string

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

func TrimLower

func TrimLower(str string) string

TrimLower return the trim and lower format of a string

func TrimQuote

func TrimQuote(str string) (string, error)

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

func TrimSplit

func TrimSplit(s, sep string) []string

TrimSplit split string and return trim space string

func TrimUpper

func TrimUpper(str string) string

TrimUpper return the trim and upper format of a string

Types

This section is empty.

Jump to

Keyboard shortcuts

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