MCPcopy Index your code

hub / github.com/huandu/xstrings / functions

Functions78 in github.com/huandu/xstrings

↓ 130 callersFunctionsep
(strs ...string)
util_test.go:27
↓ 29 callersFunctionrunTestCases
(t *testing.T, converter func(string) string, cases map[string]string)
util_test.go:17
↓ 9 callersFunctionnextValidRune
(str string, prev rune)
convert.go:400
↓ 8 callersFunctionisAlphabet
Checks r is a letter but not CJK character.
count.go:52
↓ 8 callersFunctionisConnector
(r rune)
convert.go:234
↓ 7 callersFunctionLen
Len returns str's utf8 rune length.
count.go:12
↓ 7 callersFunctiontoLower
(buf *stringBuilder, wt wordType, str string, connector rune)
convert.go:418
↓ 5 callersFunctionnextWord
(str string)
convert.go:250
↓ 4 callersFunctionNewTranslator
NewTranslator creates new Translator through a from/to pattern pair.
translate.go:37
↓ 4 callersMethodaddRune
(from, to rune, singleRunes []rune)
translate.go:174
↓ 4 callersFunctionnextRuneRange
(str string, last rune)
translate.go:228
↓ 4 callersFunctionwritePadString
(output *stringBuilder, pad string, padLen, remains int)
format.go:154
↓ 3 callersFunctionRuneWidth
RuneWidth returns character width in monotype font. Multi-byte characters are usually twice the width of single byte characters. Algorithm comes from
count.go:101
↓ 3 callersFunctionSlice
Slice a string by rune. Start must satisfy 0 <= start <= rune length. End can be positive, zero or negative. If end >= 0, start and end must satisfy
manipulate.go:38
↓ 3 callersMethodTranslateRune
TranslateRune return translated rune and true if r matches the from pattern. If r doesn't match the pattern, original r is returned and translated is
translate.go:332
↓ 3 callersMethodaddRuneRange
(fromLo, fromHi, toLo, toHi rune, singleRunes []rune)
translate.go:193
↓ 3 callersFunctionallocBuffer
Lazy initialize a buffer.
common.go:9
↓ 3 callersFunctionsplit
(str string)
util_test.go:31
↓ 2 callersMethodTranslate
Translate str with a from/to pattern pair. See comment in Translate function for usage and samples.
translate.go:294
↓ 2 callersFunctioncamelCaseToLowerCase
(str string, connector rune)
convert.go:151
↓ 2 callersFunctiontoCamelCase
(str string, isBig bool)
convert.go:40
↓ 1 callersFunctionCenter
Center returns a string with pad string at both side if str's rune length is smaller than length. If str's rune length is larger than length, str itse
format.go:136
↓ 1 callersFunctionCount
Count how many runes in str match the pattern. Pattern is defined in Translate function. Samples: Count("hello", "aeiou") => 3 Count("hello", "a-k
translate.go:471
↓ 1 callersFunctionDelete
Delete runes in str matching the pattern. Pattern is defined in Translate function. Samples: Delete("hello", "aeiou") => "hll" Delete("hello", "a-
translate.go:458
↓ 1 callersFunctionExpandTabs
ExpandTabs can expand tabs ('\t') rune in str to one or more spaces dpending on current column and tabSize. The column number is reset to zero after e
format.go:24
↓ 1 callersFunctionInsert
Insert src into dst at given rune index. Index is counted by runes instead of bytes. If index is out of range of dst, panic with out of range.
manipulate.go:130
↓ 1 callersFunctionLastPartition
LastPartition splits a string by last instance of sep into three parts. The return value is a slice of strings with head, match and tail. If str cont
manipulate.go:112
↓ 1 callersFunctionLeftJustify
LeftJustify returns a string with pad string at right side if str's rune length is smaller than length. If str's rune length is larger than length, st
format.go:82
↓ 1 callersFunctionPartition
Partition splits a string by sep into three parts. The return value is a slice of strings with head, match and tail. If str contains sep, for example
manipulate.go:88
↓ 1 callersFunctionRightJustify
RightJustify returns a string with pad string at left side if str's rune length is smaller than length. If str's rune length is larger than length, st
format.go:109
↓ 1 callersFunctionScrub
Scrub scrubs invalid utf8 bytes with repl string. Adjacent invalid bytes are replaced only once.
manipulate.go:136
↓ 1 callersFunctionShuffle
Shuffle randomizes runes in a string and returns the result. It uses default random source in `math/rand`.
convert.go:505
↓ 1 callersFunctionShuffleSource
ShuffleSource randomizes runes in a string with given random source.
convert.go:525
↓ 1 callersFunctionSqueeze
Squeeze deletes adjacent repeated runes in str. If pattern is not empty, only runes matching the pattern will be squeezed. Samples: Squeeze("hello"
translate.go:503
↓ 1 callersFunctionTranslate
Translate str with the characters defined in from replaced by characters defined in to. From and to are patterns representing a set of characters. Pa
translate.go:445
↓ 1 callersFunctionWidth
Width returns string width in monotype font. Multi-byte characters are usually twice the width of single byte characters. Algorithm comes from `mb_st
count.go:83
↓ 1 callersFunctionWordCount
WordCount returns number of words in a string. Word is defined as a locale dependent string containing alphabetic characters, which may also contain
count.go:20
↓ 1 callersFunctionWordSplit
WordSplit splits a string into words. Returns a slice of words. If there is no word in a string, return nil. Word is defined as a locale dependent st
manipulate.go:182
FunctionFirstRuneToLower
FirstRuneToLower converts first rune to lower case if necessary.
convert.go:486
FunctionFirstRuneToUpper
FirstRuneToUpper converts first rune to upper case if necessary.
convert.go:468
MethodHasPattern
HasPattern returns true if Translator has one pattern at least.
translate.go:411
MethodInt63
()
convert_test.go:196
FunctionReverse
Reverse a utf8 encoded string.
manipulate.go:12
MethodSeed
(int64)
convert_test.go:202
FunctionSuccessor
Successor returns the successor to string. If there is one alphanumeric rune is found in string, increase the rune by 1. If increment generates a "ca
convert.go:567
FunctionSwapCase
SwapCase will swap characters case from upper to lower or lower to upper.
convert.go:441
FunctionTestCenter
(t *testing.T)
format_test.go:81
FunctionTestCount
(t *testing.T)
translate_test.go:62
FunctionTestDelete
(t *testing.T)
translate_test.go:47
FunctionTestExpandTabs
(t *testing.T)
format_test.go:12
FunctionTestFirstRuneToLower
(t *testing.T)
convert_test.go:120
FunctionTestFirstRuneToUpper
(t *testing.T)
convert_test.go:109
FunctionTestInsert
(t *testing.T)
manipulate_test.go:92
FunctionTestLastPartition
(t *testing.T)
manipulate_test.go:72
FunctionTestLeftJustify
(t *testing.T)
format_test.go:39
FunctionTestLen
(t *testing.T)
count_test.go:11
FunctionTestPartition
(t *testing.T)
manipulate_test.go:52
FunctionTestReverse
(t *testing.T)
manipulate_test.go:12
FunctionTestRightJustify
(t *testing.T)
format_test.go:60
FunctionTestRuneWidth
(t *testing.T)
count_test.go:52
FunctionTestScrub
(t *testing.T)
manipulate_test.go:118
FunctionTestShuffle
(t *testing.T)
convert_test.go:132
FunctionTestShuffleSource
(t *testing.T)
convert_test.go:204
FunctionTestSlice
(t *testing.T)
manipulate_test.go:20
FunctionTestSqueeze
(t *testing.T)
translate_test.go:77
FunctionTestSuccessor
(t *testing.T)
convert_test.go:218
FunctionTestSwapCase
(t *testing.T)
convert_test.go:99
FunctionTestToCamelCase
(t *testing.T)
convert_test.go:61
FunctionTestToPascalCase
(t *testing.T)
convert_test.go:80
FunctionTestToSnakeCaseAndToKebabCase
(t *testing.T)
convert_test.go:12
FunctionTestTranslate
(t *testing.T)
translate_test.go:12
FunctionTestWidth
(t *testing.T)
count_test.go:40
FunctionTestWordCount
(t *testing.T)
count_test.go:24
FunctionTestWordSplit
(t *testing.T)
manipulate_test.go:131
FunctionToCamelCase
ToCamelCase is to convert words separated by space, underscore and hyphen to camel case. Some samples. "some_words" => "someWords" "http_serv
convert.go:22
FunctionToKebabCase
ToKebabCase can convert all upper case characters in a string to kebab case format. Some samples. "FirstName" => "first-name" "HTTPServer" =>
convert.go:147
FunctionToPascalCase
ToPascalCase is to convert words separated by space, underscore and hyphen to pascal case. Some samples. "some_words" => "SomeWords" "http_se
convert.go:36
FunctionToSnakeCase
ToSnakeCase can convert all upper case characters in a string to snake case format. Some samples. "FirstName" => "first_name" "HTTPServer" =>
convert.go:128