This is a creation in Article, where the information may have evolved or changed.
The standard libarary ' s strings package provides many useful string-related functions. Here is some examples to give
Package Mainimport"FMT"Import S"Strings"varp =FMT. Printlnfunc Main () {p ("Contains:", S.contains ("tests","es")) p ("Count:", S.count ("Test","T")) p ("Hasprefix:", S.hasprefix ("Test","te")) p ("Hassuffix:", S.hassuffix ("Test","St")) p ("Index:", S.index ("Test","e")) p ("Join:", S.join ([]string{"a","b"},"-")) p ("Repeat:", S.repeat ("a",5)) p ("Replace:", S.replace ("Foo","o","0", -1)) p ("Replace:", S.replace ("Foo","o","0",1)) p ("Split:", S.split ("a-b-c-d-e","-")) p ("ToLower:", S.tolower ("TEST")) p ("ToUpper:", S.toupper ("Test") ) p ()}
Contains: trueCount: 2hasprefix: true Hassuffix: trueIndex: 1Join: a-brepeat: aaaaareplace: f00replace: f0osplit: [a b c D e]tolower: testtoupper: TEST
Summarize:
1: ...