chunk_id large_stringlengths 36 36 | doc_type large_stringclasses 2
values | category large_stringclasses 17
values | document large_stringclasses 50
values | version_raw large_stringclasses 590
values | chunk_index int64 0 262 | text large_stringlengths 11 5.69k | file_path large_stringclasses 882
values |
|---|---|---|---|---|---|---|---|
f66b6e1b-ebaa-5b4e-b2fe-b68b2003c205 | docs | golang | golang_strings | go119 | 43 | io.RuneReader, io.RuneScanner, io.Seeker, and io.WriterTo interfaces by reading
from a string.
The zero value for Reader operates like a Reader of an empty string.
#### func [NewReader](https://cs.opensource.google/go/go/+/go1.19:src/strings/reader.go;l=160) [¶](#NewReader "Go to NewReader")
```None
func NewReader(s ... | large_dataset/raw/docs/golang/strings/strings_go119.md |
94412ab8-ba93-5417-8f14-3bfb84e95912 | docs | golang | golang_strings | go119 | 44 | #### func (\*Reader) [ReadAt](https://cs.opensource.google/go/go/+/go1.19:src/strings/reader.go;l=50) [¶](#Reader.ReadAt "Go to Reader.ReadAt")
```None
func (r *Reader) ReadAt(b []byte, off int64) (n int, err error)
```
ReadAt implements the io.ReaderAt interface.
#### func (\*Reader) [ReadByte](https://cs.opensourc... | large_dataset/raw/docs/golang/strings/strings_go119.md |
662ee992-01d3-5364-bc5a-639c89815d47 | docs | golang | golang_strings | go119 | 45 | Reset resets the Reader to be reading from s.
#### func (\*Reader) [Seek](https://cs.opensource.google/go/go/+/go1.19:src/strings/reader.go;l=116) [¶](#Reader.Seek "Go to Reader.Seek")
```None
func (r *Reader) Seek(offset int64, whence int) (int64, error)
```
Seek implements the io.Seeker interface.
#### func (\*Re... | large_dataset/raw/docs/golang/strings/strings_go119.md |
e7b63deb-7b7d-5e30-9423-563532f610d9 | docs | golang | golang_strings | go119 | 46 | #### func (\*Reader) [UnreadRune](https://cs.opensource.google/go/go/+/go1.19:src/strings/reader.go;l=103) [¶](#Reader.UnreadRune "Go to Reader.UnreadRune")
```None
func (r *Reader) UnreadRune() error
```
UnreadRune implements the io.RuneScanner interface.
#### func (\*Reader) [WriteTo](https://cs.opensource.google/... | large_dataset/raw/docs/golang/strings/strings_go119.md |
f90729af-7606-537c-bfe5-3e08d8520316 | docs | golang | golang_strings | go119 | 47 | #### func [NewReplacer](https://cs.opensource.google/go/go/+/go1.19:src/strings/replace.go;l=32) [¶](#NewReplacer "Go to NewReplacer")
```None
func NewReplacer(oldnew ...string) *Replacer
```
NewReplacer returns a new Replacer from a list of old, new string
pairs. Replacements are performed in the order they appear i... | large_dataset/raw/docs/golang/strings/strings_go119.md |
d27d017a-9813-5723-ba9c-0432e61c9ce0 | docs | golang | golang_strings | go119 | 48 | Replace returns a copy of s with all replacements performed.
#### func (\*Replacer) [WriteString](https://cs.opensource.google/go/go/+/go1.19:src/strings/replace.go;l=101) [¶](#Replacer.WriteString "Go to Replacer.WriteString")
```None
func (r *Replacer) WriteString(w io.Writer, s string) (n int, err error)
```
Writ... | large_dataset/raw/docs/golang/strings/strings_go119.md |
7e0c8a53-0771-585c-b6aa-761a9d30809f | docs | golang | golang_strings | go120 | 0 | # Golang - strings
Source: https://pkg.go.dev/strings@go1.20
Version: go1.20
## Documentation [¶](#section-documentation "Go to Documentation")
### Overview [¶](#pkg-overview "Go to Overview")
Package strings implements simple functions to manipulate UTF-8 encoded strings.
For information about UTF-8 strings in Go... | large_dataset/raw/docs/golang/strings/strings_go120.md |
7022948c-d3f5-5c91-aa20-7ccfe42aef18 | docs | golang | golang_strings | go120 | 1 | * [func FieldsFunc(s string, f func(rune) bool) []string](#FieldsFunc)
* [func HasPrefix(s, prefix string) bool](#HasPrefix)
* [func HasSuffix(s, suffix string) bool](#HasSuffix)
* [func Index(s, substr string) int](#Index)
* [func IndexAny(s, chars string) int](#IndexAny)
* [func IndexByte(s string, c byte) int](#Inde... | large_dataset/raw/docs/golang/strings/strings_go120.md |
5e1ce721-4a7a-5092-ae28-568d3543d9e9 | docs | golang | golang_strings | go120 | 2 | * [func Split(s, sep string) []string](#Split)
* [func SplitAfter(s, sep string) []string](#SplitAfter)
* [func SplitAfterN(s, sep string, n int) []string](#SplitAfterN)
* [func SplitN(s, sep string, n int) []string](#SplitN)
* [func Title(s string) string](#Title)deprecated
* [func ToLower(s string) string](#ToLower)
... | large_dataset/raw/docs/golang/strings/strings_go120.md |
a2234757-4496-500c-91d8-84fb70f7001a | docs | golang | golang_strings | go120 | 3 | * [func TrimRight(s, cutset string) string](#TrimRight)
* [func TrimRightFunc(s string, f func(rune) bool) string](#TrimRightFunc)
* [func TrimSpace(s string) string](#TrimSpace)
* [func TrimSuffix(s, suffix string) string](#TrimSuffix)
* [type Builder](#Builder)
* + [func (b \*Builder) Cap() int](#Builder.Cap)
+ [fu... | large_dataset/raw/docs/golang/strings/strings_go120.md |
1140e8d1-c038-5cf3-a809-b2b51fe7de9b | docs | golang | golang_strings | go120 | 4 | + [func (r \*Reader) ReadAt(b []byte, off int64) (n int, err error)](#Reader.ReadAt)
+ [func (r \*Reader) ReadByte() (byte, error)](#Reader.ReadByte)
+ [func (r \*Reader) ReadRune() (ch rune, size int, err error)](#Reader.ReadRune)
+ [func (r \*Reader) Reset(s string)](#Reader.Reset)
+ [func (r \*Reader) Seek... | large_dataset/raw/docs/golang/strings/strings_go120.md |
5e0c6c54-c9f2-58b7-b9d5-63660c3964f8 | docs | golang | golang_strings | go120 | 5 | ### Examples [¶](#pkg-examples "Go to Examples")
* [Builder](#example-Builder)
* [Compare](#example-Compare)
* [Contains](#example-Contains)
* [ContainsAny](#example-ContainsAny)
* [ContainsRune](#example-ContainsRune)
* [Count](#example-Count)
* [Cut](#example-Cut)
* [EqualFold](#example-EqualFold)
* [Fields](#exampl... | large_dataset/raw/docs/golang/strings/strings_go120.md |
d9788bfe-d1a3-59fc-975c-fd932b639ec9 | docs | golang | golang_strings | go120 | 6 | * [SplitAfterN](#example-SplitAfterN)
* [SplitN](#example-SplitN)
* [Title](#example-Title)
* [ToLower](#example-ToLower)
* [ToLowerSpecial](#example-ToLowerSpecial)
* [ToTitle](#example-ToTitle)
* [ToTitleSpecial](#example-ToTitleSpecial)
* [ToUpper](#example-ToUpper)
* [ToUpperSpecial](#example-ToUpperSpecial)
* [Tri... | large_dataset/raw/docs/golang/strings/strings_go120.md |
1a7cf30c-71af-547b-be02-e45fd5d89547 | docs | golang | golang_strings | go120 | 7 | #### func [Clone](https://cs.opensource.google/go/go/+/go1.20:src/strings/clone.go;l=21) [¶](#Clone "Go to Clone") added in go1.18
```None
func Clone(s string) string
```
Clone returns a fresh copy of s.
It guarantees to make a copy of s into a new allocation,
which can be important when retaining only a small substr... | large_dataset/raw/docs/golang/strings/strings_go120.md |
43393e81-42d8-5eb3-83e8-698c526cfa6a | docs | golang | golang_strings | go120 | 8 | Compare is included only for symmetry with package bytes.
It is usually clearer and always faster to use the built-in
string comparison operators ==, <, >, and so on.
Example [¶](#example-Compare "Go to Example")
```None
package main
import (
"fmt"
"strings"
)
func main() {
fmt.Println(strings.Compare("a", "b"))... | large_dataset/raw/docs/golang/strings/strings_go120.md |
29df3352-48ac-57ae-8f69-051474c8b41c | docs | golang | golang_strings | go120 | 9 | Share
Format
Run
#### func [ContainsAny](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=63) [¶](#ContainsAny "Go to ContainsAny")
```None
func ContainsAny(s, chars string) bool
```
ContainsAny reports whether any Unicode code points in chars are within s.
Example [¶](#example-ContainsAny "Go t... | large_dataset/raw/docs/golang/strings/strings_go120.md |
a49c0efd-6a4a-58f4-b81e-3260f119ad18 | docs | golang | golang_strings | go120 | 10 | Example [¶](#example-ContainsRune "Go to Example")
```None
package main
import (
"fmt"
"strings"
)
func main() {
// Finds whether a string contains a particular Unicode code point.
// The code point for the lowercase letter "a", for example, is 97.
fmt.Println(strings.ContainsRune("aardvark", 97))
fmt.Println(... | large_dataset/raw/docs/golang/strings/strings_go120.md |
7dce5eed-c579-584b-ac4f-320746e89d54 | docs | golang | golang_strings | go120 | 11 | #### func [Cut](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=1262) [¶](#Cut "Go to Cut") added in go1.18
```None
func Cut(s, sep string) (before, after string, found bool)
```
Cut slices s around the first instance of sep,
returning the text before and after sep.
The found result reports wheth... | large_dataset/raw/docs/golang/strings/strings_go120.md |
bfb3a425-10e1-559a-a7b3-161fe46e01aa | docs | golang | golang_strings | go120 | 12 | #### func [CutPrefix](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=1273) [¶](#CutPrefix "Go to CutPrefix") added in go1.20
```None
func CutPrefix(s, prefix string) (after string, found bool)
```
CutPrefix returns s without the provided leading prefix string
and reports whether it found the pre... | large_dataset/raw/docs/golang/strings/strings_go120.md |
3bc4ab87-ecca-54f4-91c2-b8cfe4feb5ee | docs | golang | golang_strings | go120 | 13 | #### func [EqualFold](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=1095) [¶](#EqualFold "Go to EqualFold")
```None
func EqualFold(s, t string) bool
```
EqualFold reports whether s and t, interpreted as UTF-8 strings,
are equal under simple Unicode case-folding, which is a more general
form of ... | large_dataset/raw/docs/golang/strings/strings_go120.md |
97e89b54-9758-5269-8883-e5b9f2278fcf | docs | golang | golang_strings | go120 | 14 | characters, as defined by unicode.IsSpace, returning a slice of substrings of s or an
empty slice if s contains only white space.
Example [¶](#example-Fields "Go to Example")
```None
package main
import (
"fmt"
"strings"
)
func main() {
fmt.Printf("Fields are: %q", strings.Fields(" foo bar baz "))
}
```
```... | large_dataset/raw/docs/golang/strings/strings_go120.md |
ed8e39dc-d515-532d-a6b1-11f5932c6aaa | docs | golang | golang_strings | go120 | 15 | "strings"
"unicode"
)
func main() {
f := func(c rune) bool {
return !unicode.IsLetter(c) && !unicode.IsNumber(c)
}
fmt.Printf("Fields are: %q", strings.FieldsFunc(" foo1;bar2,baz3...", f))
}
```
```None
Output:
Fields are: ["foo1" "bar2" "baz3"]
```
Share
Format
Run
#### func [HasPrefix](https://cs.opensou... | large_dataset/raw/docs/golang/strings/strings_go120.md |
7c90b430-3217-5ffc-8537-08e5e99f19e2 | docs | golang | golang_strings | go120 | 16 | #### func [HasSuffix](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=455) [¶](#HasSuffix "Go to HasSuffix")
```None
func HasSuffix(s, suffix string) bool
```
HasSuffix tests whether the string s ends with suffix.
Example [¶](#example-HasSuffix "Go to Example")
```None
package main
import (
"... | large_dataset/raw/docs/golang/strings/strings_go120.md |
73c002ae-ae90-5d65-8d41-cc37712c9b7f | docs | golang | golang_strings | go120 | 17 | fmt.Println(strings.Index("chicken", "ken"))
fmt.Println(strings.Index("chicken", "dmr"))
}
```
```None
Output:
4
-1
```
Share
Format
Run
#### func [IndexAny](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=138) [¶](#IndexAny "Go to IndexAny")
```None
func IndexAny(s, chars string) int
```
... | large_dataset/raw/docs/golang/strings/strings_go120.md |
3a476bf1-8b14-514d-a3b0-0299ff187c5f | docs | golang | golang_strings | go120 | 18 | IndexByte returns the index of the first instance of c in s, or -1 if c is not present in s.
Example [¶](#example-IndexByte "Go to Example")
```None
package main
import (
"fmt"
"strings"
)
func main() {
fmt.Println(strings.IndexByte("golang", 'g'))
fmt.Println(strings.IndexByte("gophers", 'h'))
fmt.Println(str... | large_dataset/raw/docs/golang/strings/strings_go120.md |
d3ea53a2-977f-5934-9b3a-be7cef63f175 | docs | golang | golang_strings | go120 | 19 | Share
Format
Run
#### func [IndexRune](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=118) [¶](#IndexRune "Go to IndexRune")
```None
func IndexRune(s string, r rune) int
```
IndexRune returns the index of the first instance of the Unicode code point
r, or -1 if rune is not present in s.
If r is... | large_dataset/raw/docs/golang/strings/strings_go120.md |
9c11d92e-ad7a-5ca0-be63-548175f39dfc | docs | golang | golang_strings | go120 | 20 | Example [¶](#example-Join "Go to Example")
```None
package main
import (
"fmt"
"strings"
)
func main() {
s := []string{"foo", "bar", "baz"}
fmt.Println(strings.Join(s, ", "))
}
```
```None
Output:
foo, bar, baz
```
Share
Format
Run
#### func [LastIndex](https://cs.opensource.google/go/go/+/go1.20:src/strings... | large_dataset/raw/docs/golang/strings/strings_go120.md |
db6f6c16-38fc-5a73-9d0b-d86944820b97 | docs | golang | golang_strings | go120 | 21 | #### func [LastIndexAny](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=172) [¶](#LastIndexAny "Go to LastIndexAny")
```None
func LastIndexAny(s, chars string) int
```
LastIndexAny returns the index of the last instance of any Unicode code
point from chars in s, or -1 if no Unicode code point fr... | large_dataset/raw/docs/golang/strings/strings_go120.md |
a7a36b39-f3d6-525c-be49-6ced4f0a381f | docs | golang | golang_strings | go120 | 22 | Example [¶](#example-LastIndexByte "Go to Example")
```None
package main
import (
"fmt"
"strings"
)
func main() {
fmt.Println(strings.LastIndexByte("Hello, world", 'l'))
fmt.Println(strings.LastIndexByte("Hello, world", 'o'))
fmt.Println(strings.LastIndexByte("Hello, world", 'x'))
}
```
```None
Output:
10
8
-... | large_dataset/raw/docs/golang/strings/strings_go120.md |
12052225-c5ac-5bd2-aa4a-6040e75ec2b0 | docs | golang | golang_strings | go120 | 23 | Format
Run
#### func [Map](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=462) [¶](#Map "Go to Map")
```None
func Map(mapping func(rune) rune, s string) string
```
Map returns a copy of the string s with all its characters modified
according to the mapping function. If mapping returns a negativ... | large_dataset/raw/docs/golang/strings/strings_go120.md |
3407b296-2b65-5768-bf42-4003fdbc1442 | docs | golang | golang_strings | go120 | 24 | #### func [Repeat](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=525) [¶](#Repeat "Go to Repeat")
```None
func Repeat(s string, count int) string
```
Repeat returns a new string consisting of count copies of the string s.
It panics if count is negative or if the result of (len(s) \* count)
ove... | large_dataset/raw/docs/golang/strings/strings_go120.md |
31d64eb5-4ce1-507d-b6c5-5fa8e706ec07 | docs | golang | golang_strings | go120 | 25 | If n < 0, there is no limit on the number of replacements.
Example [¶](#example-Replace "Go to Example")
```None
package main
import (
"fmt"
"strings"
)
func main() {
fmt.Println(strings.Replace("oink oink oink", "k", "ky", 2))
fmt.Println(strings.Replace("oink oink oink", "oink", "moo", -1))
}
```
```None
Out... | large_dataset/raw/docs/golang/strings/strings_go120.md |
186b6538-bc57-590f-831b-983ee78de3a3 | docs | golang | golang_strings | go120 | 26 | ```None
Output:
moo moo moo
```
Share
Format
Run
#### func [Split](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=305) [¶](#Split "Go to Split")
```None
func Split(s, sep string) []string
```
Split slices s into all substrings separated by sep and returns a slice of
the substrings between tho... | large_dataset/raw/docs/golang/strings/strings_go120.md |
f1ce1b7a-ad38-5fd7-a403-ff22e6673864 | docs | golang | golang_strings | go120 | 27 | ```None
Output:
["a" "b" "c"]
["" "man " "plan " "canal panama"]
[" " "x" "y" "z" " "]
[""]
```
Share
Format
Run
#### func [SplitAfter](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=317) [¶](#SplitAfter "Go to SplitAfter")
```None
func SplitAfter(s, sep string) []string
```
SplitAfter slices... | large_dataset/raw/docs/golang/strings/strings_go120.md |
ffa0128c-423b-5272-8be4-04b97f9dca12 | docs | golang | golang_strings | go120 | 28 | #### func [SplitAfterN](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=289) [¶](#SplitAfterN "Go to SplitAfterN")
```None
func SplitAfterN(s, sep string, n int) []string
```
SplitAfterN slices s into substrings after each instance of sep and
returns a slice of those substrings.
The count determ... | large_dataset/raw/docs/golang/strings/strings_go120.md |
97b16367-7710-5667-a2a3-963fed829d92 | docs | golang | golang_strings | go120 | 29 | #### func [SplitN](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=276) [¶](#SplitN "Go to SplitN")
```None
func SplitN(s, sep string, n int) []string
```
SplitN slices s into substrings separated by sep and returns a slice of
the substrings between those separators.
The count determines the num... | large_dataset/raw/docs/golang/strings/strings_go120.md |
3eaf9448-1f62-5399-ab45-9ebc051eb57e | docs | golang | golang_strings | go120 | 30 | #### func [Title](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=766) deprecated
```None
func Title(s string) string
```
Title returns a copy of the string s with all Unicode letters that begin words
mapped to their Unicode title case.
Deprecated: The rule Title uses for word boundaries does no... | large_dataset/raw/docs/golang/strings/strings_go120.md |
5c761777-7f03-51c5-afe1-7051e643d40f | docs | golang | golang_strings | go120 | 31 | Example [¶](#example-ToLower "Go to Example")
```None
package main
import (
"fmt"
"strings"
)
func main() {
fmt.Println(strings.ToLower("Gopher"))
}
```
```None
Output:
gopher
```
Share
Format
Run
#### func [ToLowerSpecial](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=676) [¶](#ToLower... | large_dataset/raw/docs/golang/strings/strings_go120.md |
ff2d6e50-499e-59de-b52c-d855c7500cac | docs | golang | golang_strings | go120 | 32 | #### func [ToTitle](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=666) [¶](#ToTitle "Go to ToTitle")
```None
func ToTitle(s string) string
```
ToTitle returns a copy of the string s with all Unicode letters mapped to
their Unicode title case.
Example [¶](#example-ToTitle "Go to Example")
```N... | large_dataset/raw/docs/golang/strings/strings_go120.md |
b9ae1b0a-91cd-5056-a683-c42b4666ebc1 | docs | golang | golang_strings | go120 | 33 | Example [¶](#example-ToTitleSpecial "Go to Example")
```None
package main
import (
"fmt"
"strings"
"unicode"
)
func main() {
fmt.Println(strings.ToTitleSpecial(unicode.TurkishCase, "dünyanın ilk borsa yapısı Aizonai kabul edilir"))
}
```
```None
Output:
DÜNYANIN İLK BORSA YAPISI AİZONAİ KABUL EDİLİR
```
Share... | large_dataset/raw/docs/golang/strings/strings_go120.md |
836e8037-7396-5260-9ac6-216c22ddcdae | docs | golang | golang_strings | go120 | 34 | ToUpperSpecial returns a copy of the string s with all Unicode letters mapped to their
upper case using the case mapping specified by c.
Example [¶](#example-ToUpperSpecial "Go to Example")
```None
package main
import (
"fmt"
"strings"
"unicode"
)
func main() {
fmt.Println(strings.ToUpperSpecial(unicode.Turkish... | large_dataset/raw/docs/golang/strings/strings_go120.md |
6691c936-ea1f-5d47-b70b-52e3cca8fbe6 | docs | golang | golang_strings | go120 | 35 | trailing Unicode code points contained in cutset removed.
Example [¶](#example-Trim "Go to Example")
```None
package main
import (
"fmt"
"strings"
)
func main() {
fmt.Print(strings.Trim("¡¡¡Hello, Gophers!!!", "!¡"))
}
```
```None
Output:
Hello, Gophers
```
Share
Format
Run
#### func [TrimFunc](https://cs.op... | large_dataset/raw/docs/golang/strings/strings_go120.md |
7f2aef52-d222-5623-9cfc-0952fea74444 | docs | golang | golang_strings | go120 | 36 | #### func [TrimLeft](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=897) [¶](#TrimLeft "Go to TrimLeft")
```None
func TrimLeft(s, cutset string) string
```
TrimLeft returns a slice of the string s with all leading
Unicode code points contained in cutset removed.
To remove a prefix, use TrimPref... | large_dataset/raw/docs/golang/strings/strings_go120.md |
94540780-0c53-5fcd-af39-26cebcc5dd4c | docs | golang | golang_strings | go120 | 37 | fmt.Print(strings.TrimLeftFunc("¡¡¡Hello, Gophers!!!", func(r rune) bool {
return !unicode.IsLetter(r) && !unicode.IsNumber(r)
}))
}
```
```None
Output:
Hello, Gophers!!!
```
Share
Format
Run
#### func [TrimPrefix](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=1027) [¶](#TrimPrefix "Go to... | large_dataset/raw/docs/golang/strings/strings_go120.md |
a9997b86-14b7-53c4-8b11-e839dea40c1e | docs | golang | golang_strings | go120 | 38 | #### func [TrimRight](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=945) [¶](#TrimRight "Go to TrimRight")
```None
func TrimRight(s, cutset string) string
```
TrimRight returns a slice of the string s, with all trailing
Unicode code points contained in cutset removed.
To remove a suffix, use T... | large_dataset/raw/docs/golang/strings/strings_go120.md |
bf53e9f7-3b3f-55ce-b910-5f1a857171ec | docs | golang | golang_strings | go120 | 39 | func main() {
fmt.Print(strings.TrimRightFunc("¡¡¡Hello, Gophers!!!", func(r rune) bool {
return !unicode.IsLetter(r) && !unicode.IsNumber(r)
}))
}
```
```None
Output:
¡¡¡Hello, Gophers
```
Share
Format
Run
#### func [TrimSpace](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=991) [¶](#Trim... | large_dataset/raw/docs/golang/strings/strings_go120.md |
95be9884-ed0b-5567-8b8f-b0a403212c53 | docs | golang | golang_strings | go120 | 40 | If s doesn't end with suffix, s is returned unchanged.
Example [¶](#example-TrimSuffix "Go to Example")
```None
package main
import (
"fmt"
"strings"
)
func main() {
var s = "¡¡¡Hello, Gophers!!!"
s = strings.TrimSuffix(s, ", Gophers!!!")
s = strings.TrimSuffix(s, ", Marmots!!!")
fmt.Print(s)
}
```
```None
O... | large_dataset/raw/docs/golang/strings/strings_go120.md |
2ed4997b-6b3b-5147-a2a1-9843e2b295d9 | docs | golang | golang_strings | go120 | 41 | fmt.Println(b.String())
}
```
```None
Output:
3...2...1...ignition
```
Share
Format
Run
#### func (\*Builder) [Cap](https://cs.opensource.google/go/go/+/go1.20:src/strings/builder.go;l=57) [¶](#Builder.Cap "Go to Builder.Cap") added in go1.12
```None
func (b *Builder) Cap() int
```
Cap returns the capacity of t... | large_dataset/raw/docs/golang/strings/strings_go120.md |
78a698be-d25e-598f-84a8-5a032c6257a8 | docs | golang | golang_strings | go120 | 42 | #### func (\*Builder) [Len](https://cs.opensource.google/go/go/+/go1.20:src/strings/builder.go;l=52) [¶](#Builder.Len "Go to Builder.Len") added in go1.10
```None
func (b *Builder) Len() int
```
Len returns the number of accumulated bytes; b.Len() == len(b.String()).
#### func (\*Builder) [Reset](https://cs.opensour... | large_dataset/raw/docs/golang/strings/strings_go120.md |
6d48913e-c710-5788-95f0-8bae29517d02 | docs | golang | golang_strings | go120 | 43 | Write appends the contents of p to b's buffer.
Write always returns len(p), nil.
#### func (\*Builder) [WriteByte](https://cs.opensource.google/go/go/+/go1.20:src/strings/builder.go;l=96) [¶](#Builder.WriteByte "Go to Builder.WriteByte") added in go1.10
```None
func (b *Builder) WriteByte(c byte) error
```
WriteByte... | large_dataset/raw/docs/golang/strings/strings_go120.md |
7a830156-d01d-5bf5-b741-3d36b3d57916 | docs | golang | golang_strings | go120 | 44 | WriteString appends the contents of s to b's buffer.
It returns the length of s and a nil error.
#### type [Reader](https://cs.opensource.google/go/go/+/go1.20:src/strings/reader.go;l=17) [¶](#Reader "Go to Reader")
```None
type Reader struct {
// contains filtered or unexported fields
}
```
A Reader implements the... | large_dataset/raw/docs/golang/strings/strings_go120.md |
5ac10558-fcf1-56d0-99a6-d70cf08496b0 | docs | golang | golang_strings | go120 | 45 | #### func (\*Reader) [Len](https://cs.opensource.google/go/go/+/go1.20:src/strings/reader.go;l=25) [¶](#Reader.Len "Go to Reader.Len")
```None
func (r *Reader) Len() int
```
Len returns the number of bytes of the unread portion of the
string.
#### func (\*Reader) [Read](https://cs.opensource.google/go/go/+/go1.20:sr... | large_dataset/raw/docs/golang/strings/strings_go120.md |
747e876e-e36e-5405-8fd6-fb7e73152239 | docs | golang | golang_strings | go120 | 46 | #### func (\*Reader) [ReadRune](https://cs.opensource.google/go/go/+/go1.20:src/strings/reader.go;l=87) [¶](#Reader.ReadRune "Go to Reader.ReadRune")
```None
func (r *Reader) ReadRune() (ch rune, size int, err error)
```
ReadRune implements the io.RuneReader interface.
#### func (\*Reader) [Reset](https://cs.opensou... | large_dataset/raw/docs/golang/strings/strings_go120.md |
571fd4d5-8f8a-5e82-9315-ae17fbd4e05c | docs | golang | golang_strings | go120 | 47 | Size returns the original length of the underlying string.
Size is the number of bytes available for reading via ReadAt.
The returned value is always the same and is not affected by calls
to any other method.
#### func (\*Reader) [UnreadByte](https://cs.opensource.google/go/go/+/go1.20:src/strings/reader.go;l=77) [¶](... | large_dataset/raw/docs/golang/strings/strings_go120.md |
b9b902a6-846a-5498-9df8-ef559476a7ee | docs | golang | golang_strings | go120 | 48 | #### type [Replacer](https://cs.opensource.google/go/go/+/go1.20:src/strings/replace.go;l=14) [¶](#Replacer "Go to Replacer")
```None
type Replacer struct {
// contains filtered or unexported fields
}
```
Replacer replaces a list of strings with replacements.
It is safe for concurrent use by multiple goroutines.
##... | large_dataset/raw/docs/golang/strings/strings_go120.md |
c7a1d2ba-fb58-5e2c-bf2b-457186f2df73 | docs | golang | golang_strings | go120 | 49 | ```None
Output:
This is <b>HTML</b>!
```
Share
Format
Run
#### func (\*Replacer) [Replace](https://cs.opensource.google/go/go/+/go1.20:src/strings/replace.go;l=95) [¶](#Replacer.Replace "Go to Replacer.Replace")
```None
func (r *Replacer) Replace(s string) string
```
Replace returns a copy of s with al... | large_dataset/raw/docs/golang/strings/strings_go120.md |
b4824f5d-1c64-5b1d-b8fc-bd7077feabc0 | docs | golang | golang_strings | go1210 | 0 | # Golang - strings
Source: https://pkg.go.dev/strings@go1.21.0
Version: go1.21.0
## Documentation [¶](#section-documentation "Go to Documentation")
### Overview [¶](#pkg-overview "Go to Overview")
Package strings implements simple functions to manipulate UTF-8 encoded strings.
For information about UTF-8 strings i... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
3f52bc08-cf96-5a67-843b-9df60e1f31e7 | docs | golang | golang_strings | go1210 | 1 | * [func EqualFold(s, t string) bool](#EqualFold)
* [func Fields(s string) []string](#Fields)
* [func FieldsFunc(s string, f func(rune) bool) []string](#FieldsFunc)
* [func HasPrefix(s, prefix string) bool](#HasPrefix)
* [func HasSuffix(s, suffix string) bool](#HasSuffix)
* [func Index(s, substr string) int](#Index)
* [... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
3a003faa-46c7-59a8-8864-0b13b24c53ee | docs | golang | golang_strings | go1210 | 2 | * [func ReplaceAll(s, old, new string) string](#ReplaceAll)
* [func Split(s, sep string) []string](#Split)
* [func SplitAfter(s, sep string) []string](#SplitAfter)
* [func SplitAfterN(s, sep string, n int) []string](#SplitAfterN)
* [func SplitN(s, sep string, n int) []string](#SplitN)
* [func Title(s string) string](#T... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
63b8f1d0-0405-50ac-b8f6-e34a225a39c8 | docs | golang | golang_strings | go1210 | 3 | * [func TrimPrefix(s, prefix string) string](#TrimPrefix)
* [func TrimRight(s, cutset string) string](#TrimRight)
* [func TrimRightFunc(s string, f func(rune) bool) string](#TrimRightFunc)
* [func TrimSpace(s string) string](#TrimSpace)
* [func TrimSuffix(s, suffix string) string](#TrimSuffix)
* [type Builder](#Builder... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
34421c6c-8ccb-57f5-823e-54bc4f19d51a | docs | golang | golang_strings | go1210 | 4 | + [func (r \*Reader) Read(b []byte) (n int, err error)](#Reader.Read)
+ [func (r \*Reader) ReadAt(b []byte, off int64) (n int, err error)](#Reader.ReadAt)
+ [func (r \*Reader) ReadByte() (byte, error)](#Reader.ReadByte)
+ [func (r \*Reader) ReadRune() (ch rune, size int, err error)](#Reader.ReadRune)
+ [func ... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
8941abd3-daf6-54cd-bbe9-c5cbcea1c05c | docs | golang | golang_strings | go1210 | 5 | ### Examples [¶](#pkg-examples "Go to Examples")
* [Builder](#example-Builder)
* [Clone](#example-Clone)
* [Compare](#example-Compare)
* [Contains](#example-Contains)
* [ContainsAny](#example-ContainsAny)
* [ContainsRune](#example-ContainsRune)
* [Count](#example-Count)
* [Cut](#example-Cut)
* [CutPrefix](#example-Cut... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
faf5a7ed-0d60-5226-8ab0-9bfcf959c675 | docs | golang | golang_strings | go1210 | 6 | * [Split](#example-Split)
* [SplitAfter](#example-SplitAfter)
* [SplitAfterN](#example-SplitAfterN)
* [SplitN](#example-SplitN)
* [Title](#example-Title)
* [ToLower](#example-ToLower)
* [ToLowerSpecial](#example-ToLowerSpecial)
* [ToTitle](#example-ToTitle)
* [ToTitleSpecial](#example-ToTitleSpecial)
* [ToUpper](#examp... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
58efcadc-d9ae-5ee8-975b-bab33cc2ba9c | docs | golang | golang_strings | go1210 | 7 | ### Variables [¶](#pkg-variables "Go to Variables")
This section is empty.
### Functions [¶](#pkg-functions "Go to Functions")
#### func [Clone](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/clone.go;l=21) [¶](#Clone "Go to Clone") added in go1.18
```None
func Clone(s string) string
```
Clone returns a... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
8a0c7820-0eb0-5e85-b5cd-22c5a4bcad32 | docs | golang | golang_strings | go1210 | 8 | fmt.Println(unsafe.StringData(s) == unsafe.StringData(clone))
}
```
```None
Output:
true
false
```
Share
Format
Run
#### func [Compare](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/compare.go;l=13) [¶](#Compare "Go to Compare") added in go1.5
```None
func Compare(a, b string) int
```
Compare returns... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
bae29a1a-8bab-5248-b1b4-6d40f7015a21 | docs | golang | golang_strings | go1210 | 9 | #### func [Contains](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=60) [¶](#Contains "Go to Contains")
```None
func Contains(s, substr string) bool
```
Contains reports whether substr is within s.
Example [¶](#example-Contains "Go to Example")
```None
package main
import (
"fmt"
"strings... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
0a691eee-8bcb-53ea-836f-9d812b39cc71 | docs | golang | golang_strings | go1210 | 10 | fmt.Println(strings.ContainsAny("fail", "ui"))
fmt.Println(strings.ContainsAny("ure", "ui"))
fmt.Println(strings.ContainsAny("failure", "ui"))
fmt.Println(strings.ContainsAny("foo", ""))
fmt.Println(strings.ContainsAny("", ""))
}
```
```None
Output:
false
true
true
true
false
false
```
Share
Format
Run
#### fu... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
0f2b4dc5-e252-5012-ae8d-39a2a62172f1 | docs | golang | golang_strings | go1210 | 11 | // Finds whether a string contains a particular Unicode code point.
// The code point for the lowercase letter "a", for example, is 97.
fmt.Println(strings.ContainsRune("aardvark", 97))
fmt.Println(strings.ContainsRune("timeout", 97))
}
```
```None
Output:
true
false
```
Share
Format
Run
#### func [Count](https... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
5a7ef9a6-7c25-5feb-bb5b-b497de117a3e | docs | golang | golang_strings | go1210 | 12 | #### func [Cut](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=1278) [¶](#Cut "Go to Cut") added in go1.18
```None
func Cut(s, sep string) (before, after string, found bool)
```
Cut slices s around the first instance of sep,
returning the text before and after sep.
The found result reports whe... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
bf41260b-11ee-53fe-a50b-ef5c98c72c23 | docs | golang | golang_strings | go1210 | 13 | #### func [CutPrefix](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=1289) [¶](#CutPrefix "Go to CutPrefix") added in go1.20
```None
func CutPrefix(s, prefix string) (after string, found bool)
```
CutPrefix returns s without the provided leading prefix string
and reports whether it found the p... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
67081cae-ae71-5140-bc17-099f17df4c7a | docs | golang | golang_strings | go1210 | 14 | #### func [CutSuffix](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=1300) [¶](#CutSuffix "Go to CutSuffix") added in go1.20
```None
func CutSuffix(s, suffix string) (before string, found bool)
```
CutSuffix returns s without the provided ending suffix string
and reports whether it found the s... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
59e1c2c7-95e0-593f-b52f-89caa13cd64b | docs | golang | golang_strings | go1210 | 15 | #### func [EqualFold](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=1111) [¶](#EqualFold "Go to EqualFold")
```None
func EqualFold(s, t string) bool
```
EqualFold reports whether s and t, interpreted as UTF-8 strings,
are equal under simple Unicode case-folding, which is a more general
form o... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
6abb7cae-1d67-569b-8c46-80a23a056f39 | docs | golang | golang_strings | go1210 | 16 | characters, as defined by unicode.IsSpace, returning a slice of substrings of s or an
empty slice if s contains only white space.
Example [¶](#example-Fields "Go to Example")
```None
package main
import (
"fmt"
"strings"
)
func main() {
fmt.Printf("Fields are: %q", strings.Fields(" foo bar baz "))
}
```
```... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
80a5e293-6168-5a80-b057-ff2ae25de8d7 | docs | golang | golang_strings | go1210 | 17 | "fmt"
"strings"
"unicode"
)
func main() {
f := func(c rune) bool {
return !unicode.IsLetter(c) && !unicode.IsNumber(c)
}
fmt.Printf("Fields are: %q", strings.FieldsFunc(" foo1;bar2,baz3...", f))
}
```
```None
Output:
Fields are: ["foo1" "bar2" "baz3"]
```
Share
Format
Run
#### func [HasPrefix](https://cs.... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
13b1c0c0-358c-554d-a016-52c96951ce95 | docs | golang | golang_strings | go1210 | 18 | #### func [HasSuffix](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=472) [¶](#HasSuffix "Go to HasSuffix")
```None
func HasSuffix(s, suffix string) bool
```
HasSuffix tests whether the string s ends with suffix.
Example [¶](#example-HasSuffix "Go to Example")
```None
package main
import (
... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
2c4c7a9f-53b6-5241-8a28-bd0eaae72910 | docs | golang | golang_strings | go1210 | 19 | fmt.Println(strings.Index("chicken", "ken"))
fmt.Println(strings.Index("chicken", "dmr"))
}
```
```None
Output:
4
-1
```
Share
Format
Run
#### func [IndexAny](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=145) [¶](#IndexAny "Go to IndexAny")
```None
func IndexAny(s, chars string) int
```... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
e26a104f-e76d-51d8-8e78-29572e69d952 | docs | golang | golang_strings | go1210 | 20 | IndexByte returns the index of the first instance of c in s, or -1 if c is not present in s.
Example [¶](#example-IndexByte "Go to Example")
```None
package main
import (
"fmt"
"strings"
)
func main() {
fmt.Println(strings.IndexByte("golang", 'g'))
fmt.Println(strings.IndexByte("gophers", 'h'))
fmt.Println(str... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
eade4eb4-578e-5a5f-ae7c-033454385e78 | docs | golang | golang_strings | go1210 | 21 |
Share
Format
Run
#### func [IndexRune](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=125) [¶](#IndexRune "Go to IndexRune")
```None
func IndexRune(s string, r rune) int
```
IndexRune returns the index of the first instance of the Unicode code point
r, or -1 if rune is not present in s.
If r... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
71ab6075-9581-58a9-a68a-4404c65f46ce | docs | golang | golang_strings | go1210 | 22 | Example [¶](#example-Join "Go to Example")
```None
package main
import (
"fmt"
"strings"
)
func main() {
s := []string{"foo", "bar", "baz"}
fmt.Println(strings.Join(s, ", "))
}
```
```None
Output:
foo, bar, baz
```
Share
Format
Run
#### func [LastIndex](https://cs.opensource.google/go/go/+/go1.21.0:src/strin... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
66c44aa8-9535-5995-a6b5-de8ac0fe1888 | docs | golang | golang_strings | go1210 | 23 | #### func [LastIndexAny](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=179) [¶](#LastIndexAny "Go to LastIndexAny")
```None
func LastIndexAny(s, chars string) int
```
LastIndexAny returns the index of the last instance of any Unicode code
point from chars in s, or -1 if no Unicode code point ... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
496fe2ba-6996-5b83-9fe4-fef909599db2 | docs | golang | golang_strings | go1210 | 24 | Example [¶](#example-LastIndexByte "Go to Example")
```None
package main
import (
"fmt"
"strings"
)
func main() {
fmt.Println(strings.LastIndexByte("Hello, world", 'l'))
fmt.Println(strings.LastIndexByte("Hello, world", 'o'))
fmt.Println(strings.LastIndexByte("Hello, world", 'x'))
}
```
```None
Output:
10
8
-... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
1c119857-613e-5903-b3b4-2cdeb0c8c0bf | docs | golang | golang_strings | go1210 | 25 | Format
Run
#### func [Map](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=479) [¶](#Map "Go to Map")
```None
func Map(mapping func(rune) rune, s string) string
```
Map returns a copy of the string s with all its characters modified
according to the mapping function. If mapping returns a negat... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
c64a107f-3c05-5b69-80ff-923a46240358 | docs | golang | golang_strings | go1210 | 26 | #### func [Repeat](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=542) [¶](#Repeat "Go to Repeat")
```None
func Repeat(s string, count int) string
```
Repeat returns a new string consisting of count copies of the string s.
It panics if count is negative or if the result of (len(s) \* count)
o... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
2f8815ed-0840-5ded-b8ce-1bfab89f2d5e | docs | golang | golang_strings | go1210 | 27 | If n < 0, there is no limit on the number of replacements.
Example [¶](#example-Replace "Go to Example")
```None
package main
import (
"fmt"
"strings"
)
func main() {
fmt.Println(strings.Replace("oink oink oink", "k", "ky", 2))
fmt.Println(strings.Replace("oink oink oink", "oink", "moo", -1))
}
```
```None
Out... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
6f943bb9-b9eb-5e42-8e4c-fbbe1465100a | docs | golang | golang_strings | go1210 | 28 | ```None
Output:
moo moo moo
```
Share
Format
Run
#### func [Split](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=312) [¶](#Split "Go to Split")
```None
func Split(s, sep string) []string
```
Split slices s into all substrings separated by sep and returns a slice of
the substrings between t... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
4cc7dfde-77fd-5f76-8bf1-38daefe62bb1 | docs | golang | golang_strings | go1210 | 29 | ```None
Output:
["a" "b" "c"]
["" "man " "plan " "canal panama"]
[" " "x" "y" "z" " "]
[""]
```
Share
Format
Run
#### func [SplitAfter](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=324) [¶](#SplitAfter "Go to SplitAfter")
```None
func SplitAfter(s, sep string) []string
```
SplitAfter slic... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
21a79157-ef9d-5830-881f-257097020354 | docs | golang | golang_strings | go1210 | 30 | #### func [SplitAfterN](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=296) [¶](#SplitAfterN "Go to SplitAfterN")
```None
func SplitAfterN(s, sep string, n int) []string
```
SplitAfterN slices s into substrings after each instance of sep and
returns a slice of those substrings.
The count dete... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
bd8e1cfb-a619-5572-aa55-64db5d2a89bd | docs | golang | golang_strings | go1210 | 31 | #### func [SplitN](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=283) [¶](#SplitN "Go to SplitN")
```None
func SplitN(s, sep string, n int) []string
```
SplitN slices s into substrings separated by sep and returns a slice of
the substrings between those separators.
The count determines the n... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
8e911cc6-5d0b-5d63-81c0-f3b838d63eaf | docs | golang | golang_strings | go1210 | 32 | #### func [Title](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=782) deprecated
```None
func Title(s string) string
```
Title returns a copy of the string s with all Unicode letters that begin words
mapped to their Unicode title case.
Deprecated: The rule Title uses for word boundaries does ... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
9dec5db6-fd8c-5bb9-9e98-f8f6b1097fc0 | docs | golang | golang_strings | go1210 | 33 | Example [¶](#example-ToLower "Go to Example")
```None
package main
import (
"fmt"
"strings"
)
func main() {
fmt.Println(strings.ToLower("Gopher"))
}
```
```None
Output:
gopher
```
Share
Format
Run
#### func [ToLowerSpecial](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=692) [¶](#ToLow... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
30f6a55b-3591-5074-8f22-391f151e018a | docs | golang | golang_strings | go1210 | 34 | #### func [ToTitle](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=682) [¶](#ToTitle "Go to ToTitle")
```None
func ToTitle(s string) string
```
ToTitle returns a copy of the string s with all Unicode letters mapped to
their Unicode title case.
Example [¶](#example-ToTitle "Go to Example")
``... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
0d4a1145-6dc0-58b1-82f0-d52c26fadf0d | docs | golang | golang_strings | go1210 | 35 | Example [¶](#example-ToTitleSpecial "Go to Example")
```None
package main
import (
"fmt"
"strings"
"unicode"
)
func main() {
fmt.Println(strings.ToTitleSpecial(unicode.TurkishCase, "dünyanın ilk borsa yapısı Aizonai kabul edilir"))
}
```
```None
Output:
DÜNYANIN İLK BORSA YAPISI AİZONAİ KABUL EDİLİR
```
Share... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
cd658e0c-0f8a-58b1-96c4-2c2c2a711516 | docs | golang | golang_strings | go1210 | 36 | ToUpperSpecial returns a copy of the string s with all Unicode letters mapped to their
upper case using the case mapping specified by c.
Example [¶](#example-ToUpperSpecial "Go to Example")
```None
package main
import (
"fmt"
"strings"
"unicode"
)
func main() {
fmt.Println(strings.ToUpperSpecial(unicode.Turkish... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
270abb62-4746-5d4b-bd99-3cf91de2c119 | docs | golang | golang_strings | go1210 | 37 | fmt.Printf("%s\n", strings.ToValidUTF8("\xed\xa0\x80", "abc"))
}
```
```None
Output:
abc
abc
abc
```
Share
Format
Run
#### func [Trim](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=896) [¶](#Trim "Go to Trim")
```None
func Trim(s, cutset string) string
```
Trim returns a slice of the str... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
fc28b22e-6779-5686-a1f9-fbdd5577d1d7 | docs | golang | golang_strings | go1210 | 38 | "fmt"
"strings"
"unicode"
)
func main() {
fmt.Print(strings.TrimFunc("¡¡¡Hello, Gophers!!!", func(r rune) bool {
return !unicode.IsLetter(r) && !unicode.IsNumber(r)
}))
}
```
```None
Output:
Hello, Gophers
```
Share
Format
Run
#### func [TrimLeft](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/st... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
83dd74b4-6455-58a6-8674-f936e696dd66 | docs | golang | golang_strings | go1210 | 39 | #### func [TrimLeftFunc](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=801) [¶](#TrimLeftFunc "Go to TrimLeftFunc")
```None
func TrimLeftFunc(s string, f func(rune) bool) string
```
TrimLeftFunc returns a slice of the string s with all leading
Unicode code points c satisfying f(c) removed.
E... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
ce7ce8f9-cec0-592d-babb-c59fc053a3c4 | docs | golang | golang_strings | go1210 | 40 | Example [¶](#example-TrimPrefix "Go to Example")
```None
package main
import (
"fmt"
"strings"
)
func main() {
var s = "¡¡¡Hello, Gophers!!!"
s = strings.TrimPrefix(s, "¡¡¡Hello, ")
s = strings.TrimPrefix(s, "¡¡¡Howdy, ")
fmt.Print(s)
}
```
```None
Output:
Gophers!!!
```
Share
Format
Run
#### func [TrimRig... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
c68cd384-76c4-587d-8c64-6003e1faa723 | docs | golang | golang_strings | go1210 | 41 | #### func [TrimRightFunc](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=811) [¶](#TrimRightFunc "Go to TrimRightFunc")
```None
func TrimRightFunc(s string, f func(rune) bool) string
```
TrimRightFunc returns a slice of the string s with all trailing
Unicode code points c satisfying f(c) remov... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
a24f7ce1-aebc-5009-893f-1cbe476f75eb | docs | golang | golang_strings | go1210 | 42 | import (
"fmt"
"strings"
)
func main() {
fmt.Println(strings.TrimSpace(" \t\n Hello, Gophers \n\t\r\n"))
}
```
```None
Output:
Hello, Gophers
```
Share
Format
Run
#### func [TrimSuffix](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=1052) [¶](#TrimSuffix "Go to TrimSuffix") added in go1.... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
d2d8169b-ca23-5e8e-8fca-9ec7ef750bdb | docs | golang | golang_strings | go1210 | 43 | ### Types [¶](#pkg-types "Go to Types")
#### type [Builder](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/builder.go;l=16) [¶](#Builder "Go to Builder") added in go1.10
```None
type Builder struct {
// contains filtered or unexported fields
}
```
A Builder is used to efficiently build a string using Wri... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.