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
9ae263de-590e-5b8f-bdd5-239abb744f9d
docs
golang
golang_strings
go1230
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.23.0:src/strings/st...
large_dataset/raw/docs/golang/strings/strings_go1230.md
61fd0a6d-0ee9-5308-93f1-ee16ac794e08
docs
golang
golang_strings
go1230
39
#### func [TrimLeftFunc](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=833) [¶](#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_go1230.md
3b880d4b-0bb8-5427-be3e-f887ba4af43c
docs
golang
golang_strings
go1230
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_go1230.md
2eff6f44-053c-541f-938c-f795a49ab5cf
docs
golang
golang_strings
go1230
41
#### func [TrimRightFunc](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=843) [¶](#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_go1230.md
a0926ba5-d581-5cef-b89b-db14a8b9ad8f
docs
golang
golang_strings
go1230
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.23.0:src/strings/strings.go;l=1081) [¶](#TrimSuffix "Go to TrimSuffix") added in go1....
large_dataset/raw/docs/golang/strings/strings_go1230.md
46d5b4d2-8956-58c1-b108-e94ddd5f412f
docs
golang
golang_strings
go1230
43
### Types [¶](#pkg-types "Go to Types") #### type [Builder](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/builder.go;l=17) [¶](#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 [Bu...
large_dataset/raw/docs/golang/strings/strings_go1230.md
adeab7cd-bfdb-5a47-8761-a6bdb511735c
docs
golang
golang_strings
go1230
44
Cap returns the capacity of the builder's underlying byte slice. It is the total space allocated for the string being built and includes any bytes already written. #### func (\*Builder) [Grow](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/builder.go;l=69) [¶](#Builder.Grow "Go to Builder.Grow") added in go...
large_dataset/raw/docs/golang/strings/strings_go1230.md
193c8b83-c98b-5313-94c3-0ec99ad16a4c
docs
golang
golang_strings
go1230
45
#### func (\*Builder) [Reset](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/builder.go;l=53) [¶](#Builder.Reset "Go to Builder.Reset") added in go1.10 ```None func (b *Builder) Reset() ``` Reset resets the [Builder](#Builder) to be empty. #### func (\*Builder) [String](https://cs.opensource.google/go/go/...
large_dataset/raw/docs/golang/strings/strings_go1230.md
02eb89a4-8378-505a-897d-9ecfe404e7bf
docs
golang
golang_strings
go1230
46
#### func (\*Builder) [WriteByte](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/builder.go;l=89) [¶](#Builder.WriteByte "Go to Builder.WriteByte") added in go1.10 ```None func (b *Builder) WriteByte(c byte) error ``` WriteByte appends the byte c to b's buffer. The returned error is always nil. #### func ...
large_dataset/raw/docs/golang/strings/strings_go1230.md
4d2f6fd3-4087-53ea-b47e-3f3093ff1d0f
docs
golang
golang_strings
go1230
47
#### type [Reader](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/reader.go;l=17) [¶](#Reader "Go to Reader") ```None type Reader struct { // contains filtered or unexported fields } ``` A Reader implements the [io.Reader](/io#Reader), [io.ReaderAt](/io#ReaderAt), [io.ByteReader](/io#ByteReader), [io.Byte...
large_dataset/raw/docs/golang/strings/strings_go1230.md
f6763fd0-df58-59de-a0eb-8548a11367df
docs
golang
golang_strings
go1230
48
#### func (\*Reader) [Len](https://cs.opensource.google/go/go/+/go1.23.0: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.23....
large_dataset/raw/docs/golang/strings/strings_go1230.md
bedf2b19-810f-5bad-a263-2ebda40e27a8
docs
golang
golang_strings
go1230
49
ReadByte implements the [io.ByteReader](/io#ByteReader) interface. #### func (\*Reader) [ReadRune](https://cs.opensource.google/go/go/+/go1.23.0: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...
large_dataset/raw/docs/golang/strings/strings_go1230.md
2e65379b-a6ac-5e61-8c7c-c55574ae5804
docs
golang
golang_strings
go1230
50
#### func (\*Reader) [Size](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/reader.go;l=36) [¶](#Reader.Size "Go to Reader.Size") added in go1.5 ```None func (r *Reader) Size() int64 ``` Size returns the original length of the underlying string. Size is the number of bytes available for reading via [Reader....
large_dataset/raw/docs/golang/strings/strings_go1230.md
285f7b6c-840d-5af2-a04e-fe939fafdb1b
docs
golang
golang_strings
go1230
51
#### func (\*Reader) [WriteTo](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/reader.go;l=137) [¶](#Reader.WriteTo "Go to Reader.WriteTo") added in go1.1 ```None func (r *Reader) WriteTo(w io.Writer) (n int64, err error) ``` WriteTo implements the [io.WriterTo](/io#WriterTo) interface. #### type [Replacer...
large_dataset/raw/docs/golang/strings/strings_go1230.md
6bd32850-d635-50db-a793-2ea34517704f
docs
golang
golang_strings
go1230
52
comparisons are done in argument order. NewReplacer panics if given an odd number of arguments. Example [¶](#example-NewReplacer "Go to Example") ```None package main import ( "fmt" "strings" ) func main() { r := strings.NewReplacer("<", "&lt;", ">", "&gt;") fmt.Println(r.Replace("This is <b>HTML</b>!")) } ```...
large_dataset/raw/docs/golang/strings/strings_go1230.md
5909b72e-11b0-57b8-8b7c-cb73fc927773
docs
golang
golang_strings
go1240
0
# Golang - strings Source: https://pkg.go.dev/strings@go1.24.0 Version: go1.24.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_go1240.md
5dc591d5-c71e-56dd-b96e-96b956d302e3
docs
golang
golang_strings
go1240
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 FieldsFuncSeq(s string, f func(rune) bool) iter.Seq[string]](#FieldsFuncSeq) * [func FieldsSeq(s string) iter.Seq[string]](#FieldsSeq) * [func HasPr...
large_dataset/raw/docs/golang/strings/strings_go1240.md
5c2ad1f0-349f-5437-9508-f3a1b59baa2e
docs
golang
golang_strings
go1240
2
* [func Lines(s string) iter.Seq[string]](#Lines) * [func Map(mapping func(rune) rune, s string) string](#Map) * [func Repeat(s string, count int) string](#Repeat) * [func Replace(s, old, new string, n int) string](#Replace) * [func ReplaceAll(s, old, new string) string](#ReplaceAll) * [func Split(s, sep string) []stri...
large_dataset/raw/docs/golang/strings/strings_go1240.md
bca8d65c-d87e-57ec-8ff5-665ed58e7ec2
docs
golang
golang_strings
go1240
3
* [func ToUpperSpecial(c unicode.SpecialCase, s string) string](#ToUpperSpecial) * [func ToValidUTF8(s, replacement string) string](#ToValidUTF8) * [func Trim(s, cutset string) string](#Trim) * [func TrimFunc(s string, f func(rune) bool) string](#TrimFunc) * [func TrimLeft(s, cutset string) string](#TrimLeft) * [func T...
large_dataset/raw/docs/golang/strings/strings_go1240.md
fa5ea10a-02ec-5a74-b06f-992e242feef8
docs
golang
golang_strings
go1240
4
+ [func (b \*Builder) Write(p []byte) (int, error)](#Builder.Write) + [func (b \*Builder) WriteByte(c byte) error](#Builder.WriteByte) + [func (b \*Builder) WriteRune(r rune) (int, error)](#Builder.WriteRune) + [func (b \*Builder) WriteString(s string) (int, error)](#Builder.WriteString) * [type Reader](#Reader...
large_dataset/raw/docs/golang/strings/strings_go1240.md
813fba87-a959-52d6-b9ee-ab23831725fd
docs
golang
golang_strings
go1240
5
+ [func (r \*Reader) UnreadRune() error](#Reader.UnreadRune) + [func (r \*Reader) WriteTo(w io.Writer) (n int64, err error)](#Reader.WriteTo) * [type Replacer](#Replacer) * + [func NewReplacer(oldnew ...string) \*Replacer](#NewReplacer) * + [func (r \*Replacer) Replace(s string) string](#Replacer.Replace) + [func...
large_dataset/raw/docs/golang/strings/strings_go1240.md
8fadd723-d239-5209-8599-8c3e02d45e9a
docs
golang
golang_strings
go1240
6
* [IndexAny](#example-IndexAny) * [IndexByte](#example-IndexByte) * [IndexFunc](#example-IndexFunc) * [IndexRune](#example-IndexRune) * [Join](#example-Join) * [LastIndex](#example-LastIndex) * [LastIndexAny](#example-LastIndexAny) * [LastIndexByte](#example-LastIndexByte) * [LastIndexFunc](#example-LastIndexFunc) * [M...
large_dataset/raw/docs/golang/strings/strings_go1240.md
45a6ccb3-356c-5964-aa65-a239faa702d5
docs
golang
golang_strings
go1240
7
* [TrimPrefix](#example-TrimPrefix) * [TrimRight](#example-TrimRight) * [TrimRightFunc](#example-TrimRightFunc) * [TrimSpace](#example-TrimSpace) * [TrimSuffix](#example-TrimSuffix) ### Constants [¶](#pkg-constants "Go to Constants") This section is empty. ### Variables [¶](#pkg-variables "Go to Variables") This se...
large_dataset/raw/docs/golang/strings/strings_go1240.md
fe1c46c1-49bb-5504-997f-bc6dd96ac12b
docs
golang
golang_strings
go1240
8
For strings of length zero the string "" will be returned and no allocation is made. Example [¶](#example-Clone "Go to Example") ```None package main import ( "fmt" "strings" "unsafe" ) func main() { s := "abc" clone := strings.Clone(s) fmt.Println(s == clone) fmt.Println(unsafe.StringData(s) == unsafe.Strin...
large_dataset/raw/docs/golang/strings/strings_go1240.md
66a9c4f6-6a6f-55f4-ad0b-4914639dd932
docs
golang
golang_strings
go1240
9
"strings" ) func main() { fmt.Println(strings.Compare("a", "b")) fmt.Println(strings.Compare("a", "a")) fmt.Println(strings.Compare("b", "a")) } ``` ```None Output: -1 0 1 ``` Share Format Run #### func [Contains](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=62) [¶](#Contains "Go to C...
large_dataset/raw/docs/golang/strings/strings_go1240.md
de525082-724a-513e-9d84-7b022f1e78ac
docs
golang
golang_strings
go1240
10
ContainsAny reports whether any Unicode code points in chars are within s. Example [¶](#example-ContainsAny "Go to Example") ```None package main import ( "fmt" "strings" ) func main() { fmt.Println(strings.ContainsAny("team", "i")) fmt.Println(strings.ContainsAny("fail", "ui")) fmt.Println(strings.ContainsAny...
large_dataset/raw/docs/golang/strings/strings_go1240.md
8671caf7-f4ff-5a92-a2ba-3cbff0bf4bc2
docs
golang
golang_strings
go1240
11
return r == 'a' || r == 'e' || r == 'i' || r == 'o' || r == 'u' } fmt.Println(strings.ContainsFunc("hello", f)) fmt.Println(strings.ContainsFunc("rhythms", f)) } ``` ```None Output: true false ``` Share Format Run #### func [ContainsRune](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=7...
large_dataset/raw/docs/golang/strings/strings_go1240.md
03c99a0b-d5d1-5295-8d7f-a4452e87f520
docs
golang
golang_strings
go1240
12
#### func [Count](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=42) [¶](#Count "Go to Count") ```None func Count(s, substr string) int ``` Count counts the number of non-overlapping instances of substr in s. If substr is an empty string, Count returns 1 + the number of Unicode code points in ...
large_dataset/raw/docs/golang/strings/strings_go1240.md
0273d58d-1268-54ae-9fe7-4349d006f928
docs
golang
golang_strings
go1240
13
Example [¶](#example-Cut "Go to Example") ```None package main import ( "fmt" "strings" ) func main() { show := func(s, sep string) { before, after, found := strings.Cut(s, sep) fmt.Printf("Cut(%q, %q) = %q, %q, %v\n", s, sep, before, after, found) } show("Gopher", "Go") show("Gopher", "ph") show("Gopher"...
large_dataset/raw/docs/golang/strings/strings_go1240.md
0483b507-89cb-5fc3-9b52-7f14afada823
docs
golang
golang_strings
go1240
14
Example [¶](#example-CutPrefix "Go to Example") ```None package main import ( "fmt" "strings" ) func main() { show := func(s, sep string) { after, found := strings.CutPrefix(s, sep) fmt.Printf("CutPrefix(%q, %q) = %q, %v\n", s, sep, after, found) } show("Gopher", "Go") show("Gopher", "ph") } ``` ```None O...
large_dataset/raw/docs/golang/strings/strings_go1240.md
85c75e6d-306b-567f-84e0-574b347e4ad8
docs
golang
golang_strings
go1240
15
show := func(s, sep string) { before, found := strings.CutSuffix(s, sep) fmt.Printf("CutSuffix(%q, %q) = %q, %v\n", s, sep, before, found) } show("Gopher", "Go") show("Gopher", "er") } ``` ```None Output: CutSuffix("Gopher", "Go") = "Gopher", false CutSuffix("Gopher", "er") = "Goph", true ``` Share Format Ru...
large_dataset/raw/docs/golang/strings/strings_go1240.md
6974cd86-378a-5c10-828d-60c665ab7c19
docs
golang
golang_strings
go1240
16
} ``` ```None Output: true true false ``` Share Format Run #### func [Fields](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=382) [¶](#Fields "Go to Fields") ```None func Fields(s string) []string ``` Fields splits the string s around each instance of one or more consecutive white space ch...
large_dataset/raw/docs/golang/strings/strings_go1240.md
a47b9095-72cc-5c63-a526-54aa6bf1e2a8
docs
golang
golang_strings
go1240
17
and returns an array of slices of s. If all code points in s satisfy f(c) or the string is empty, an empty slice is returned. FieldsFunc makes no guarantees about the order in which it calls f(c) and assumes that f always returns the same value for a given c. Example [¶](#example-FieldsFunc "Go to Example") ```None ...
large_dataset/raw/docs/golang/strings/strings_go1240.md
fece0977-d1ab-54b9-8062-8b37c7c8bbc4
docs
golang
golang_strings
go1240
18
The iterator yields the same strings that would be returned by [FieldsFunc](#FieldsFunc)(s), but without constructing the slice. #### func [FieldsSeq](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/iter.go;l=90) [¶](#FieldsSeq "Go to FieldsSeq") added in go1.24.0 ```None func FieldsSeq(s string) iter.Seq[s...
large_dataset/raw/docs/golang/strings/strings_go1240.md
4cdb1c20-47eb-5298-99b6-24148147623e
docs
golang
golang_strings
go1240
19
fmt.Println(strings.HasPrefix("Gopher", "C")) fmt.Println(strings.HasPrefix("Gopher", "")) } ``` ```None Output: true false true ``` Share Format Run #### func [HasSuffix](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=521) [¶](#HasSuffix "Go to HasSuffix") ```None func HasSuffix(s, suffi...
large_dataset/raw/docs/golang/strings/strings_go1240.md
d28d2b96-edaf-5948-9f90-781605c25045
docs
golang
golang_strings
go1240
20
Index returns the index of the first instance of substr in s, or -1 if substr is not present in s. Example [¶](#example-Index "Go to Example") ```None package main import ( "fmt" "strings" ) func main() { fmt.Println(strings.Index("chicken", "ken")) fmt.Println(strings.Index("chicken", "dmr")) } ``` ```None Ou...
large_dataset/raw/docs/golang/strings/strings_go1240.md
e9c0ca0e-f193-5a89-9c7c-95c0811cc6a6
docs
golang
golang_strings
go1240
21
#### func [IndexByte](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=119) [¶](#IndexByte "Go to IndexByte") added in go1.2 ```None func IndexByte(s string, c byte) int ``` IndexByte returns the index of the first instance of c in s, or -1 if c is not present in s. Example [¶](#example-IndexBy...
large_dataset/raw/docs/golang/strings/strings_go1240.md
46635ffe-38ec-5083-95cc-3170d2d82759
docs
golang
golang_strings
go1240
22
func main() { f := func(c rune) bool { return unicode.Is(unicode.Han, c) } fmt.Println(strings.IndexFunc("Hello, 世界", f)) fmt.Println(strings.IndexFunc("Hello, world", f)) } ``` ```None Output: 7 -1 ``` Share Format Run #### func [IndexRune](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go...
large_dataset/raw/docs/golang/strings/strings_go1240.md
4374cba0-8b73-5147-a5a4-1a0d2aba1d8d
docs
golang
golang_strings
go1240
23
#### func [Join](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=483) [¶](#Join "Go to Join") ```None func Join(elems []string, sep string) string ``` Join concatenates the elements of its first argument to create a single string. The separator string sep is placed between elements in the resul...
large_dataset/raw/docs/golang/strings/strings_go1240.md
aa4c894a-a71c-5fa9-8194-76b911ed7990
docs
golang
golang_strings
go1240
24
fmt.Println(strings.LastIndex("go gopher", "go")) fmt.Println(strings.LastIndex("go gopher", "rodent")) } ``` ```None Output: 0 3 -1 ``` Share Format Run #### func [LastIndexAny](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=235) [¶](#LastIndexAny "Go to LastIndexAny") ```None func LastI...
large_dataset/raw/docs/golang/strings/strings_go1240.md
bf08b621-b347-5845-90da-8c7aedea4caf
docs
golang
golang_strings
go1240
25
#### func [LastIndexByte](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=285) [¶](#LastIndexByte "Go to LastIndexByte") added in go1.5 ```None func LastIndexByte(s string, c byte) int ``` LastIndexByte returns the index of the last instance of c in s, or -1 if c is not present in s. Example [...
large_dataset/raw/docs/golang/strings/strings_go1240.md
35890125-a49a-5dc9-9aa9-4a61ed1132b3
docs
golang
golang_strings
go1240
26
```None package main import ( "fmt" "strings" "unicode" ) func main() { fmt.Println(strings.LastIndexFunc("go 123", unicode.IsNumber)) fmt.Println(strings.LastIndexFunc("123 go", unicode.IsNumber)) fmt.Println(strings.LastIndexFunc("go", unicode.IsNumber)) } ``` ```None Output: 5 2 -1 ``` Share Format Run #...
large_dataset/raw/docs/golang/strings/strings_go1240.md
98824cbd-8278-520a-806c-79220ec9115f
docs
golang
golang_strings
go1240
27
#### func [Map](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=528) [¶](#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 negative value, t...
large_dataset/raw/docs/golang/strings/strings_go1240.md
bd4f9a2d-8471-50b4-be47-ee1aa45194e3
docs
golang
golang_strings
go1240
28
#### func [Repeat](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=612) [¶](#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_go1240.md
6af6ab20-0380-5bed-9554-d1ac586848e3
docs
golang
golang_strings
go1240
29
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_go1240.md
7e169ca9-3510-5087-9ebe-c02284b316fc
docs
golang
golang_strings
go1240
30
```None Output: moo moo moo ``` Share Format Run #### func [Split](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=361) [¶](#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_go1240.md
e511fe94-964b-5831-ab9b-002f86b3d4b3
docs
golang
golang_strings
go1240
31
fmt.Printf("%q\n", strings.Split("", "Bernardo O'Higgins")) } ``` ```None Output: ["a" "b" "c"] ["" "man " "plan " "canal panama"] [" " "x" "y" "z" " "] [""] ``` Share Format Run #### func [SplitAfter](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=373) [¶](#SplitAfter "Go to SplitAfter") ...
large_dataset/raw/docs/golang/strings/strings_go1240.md
3ed2af60-50ef-582c-a91a-73ad45cf3d66
docs
golang
golang_strings
go1240
32
#### func [SplitAfterN](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=345) [¶](#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_go1240.md
ab283ff2-6e9a-55ac-9481-3cf43f39b6f5
docs
golang
golang_strings
go1240
33
#### func [SplitAfterSeq](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/iter.go;l=82) [¶](#SplitAfterSeq "Go to SplitAfterSeq") added in go1.24.0 ```None func SplitAfterSeq(s, sep string) iter.Seq[string] ``` SplitAfterSeq returns an iterator over substrings of s split after each instance of sep. The iter...
large_dataset/raw/docs/golang/strings/strings_go1240.md
725aa785-f470-558b-8578-601dc2da73e7
docs
golang
golang_strings
go1240
34
Edge cases for s and sep (for example, empty strings) are handled as described in the documentation for [Split](#Split). To split around the first instance of a separator, see [Cut](#Cut). Example [¶](#example-SplitN "Go to Example") ```None package main import ( "fmt" "strings" ) func main() { fmt.Printf("%q\n...
large_dataset/raw/docs/golang/strings/strings_go1240.md
7be12fb0-83ba-58d1-b2a1-7d1df4a95ee4
docs
golang
golang_strings
go1240
35
#### func [Title](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=864) 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_go1240.md
bf739e44-a009-5630-8eac-14a554b8e70a
docs
golang
golang_strings
go1240
36
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.24.0:src/strings/strings.go;l=774) [¶](#ToLow...
large_dataset/raw/docs/golang/strings/strings_go1240.md
11ba9e1b-a6c4-5057-b818-a724e02c58ef
docs
golang
golang_strings
go1240
37
#### func [ToTitle](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=764) [¶](#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_go1240.md
96475ba8-2bea-5136-8afa-d51c26b045a6
docs
golang
golang_strings
go1240
38
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_go1240.md
0f6e42d3-1a98-5d09-8ae3-c6b9fc13058f
docs
golang
golang_strings
go1240
39
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_go1240.md
8f99d48c-2f91-5d54-9b46-e1b7b0d4aa02
docs
golang
golang_strings
go1240
40
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.24.0:src/strings/strings.go;l=978) [¶](#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_go1240.md
aa90aa1c-d466-5317-ae85-f0b4b651efd1
docs
golang
golang_strings
go1240
41
"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.24.0:src/strings/st...
large_dataset/raw/docs/golang/strings/strings_go1240.md
af39451b-c3d3-5a5a-a735-044f7b107e8e
docs
golang
golang_strings
go1240
42
#### func [TrimLeftFunc](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=883) [¶](#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_go1240.md
7a3dbff6-3f36-5967-805f-88b42059045d
docs
golang
golang_strings
go1240
43
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_go1240.md
0d441f04-01a6-5a00-a8a1-c4a5f6abb6e7
docs
golang
golang_strings
go1240
44
#### func [TrimRightFunc](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=893) [¶](#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_go1240.md
b89377a9-86bf-5a76-a20e-260915c48677
docs
golang
golang_strings
go1240
45
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.24.0:src/strings/strings.go;l=1131) [¶](#TrimSuffix "Go to TrimSuffix") added in go1....
large_dataset/raw/docs/golang/strings/strings_go1240.md
cceb2d70-7afb-514e-a82d-4152817ac327
docs
golang
golang_strings
go1240
46
### Types [¶](#pkg-types "Go to Types") #### type [Builder](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/builder.go;l=17) [¶](#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 [Bu...
large_dataset/raw/docs/golang/strings/strings_go1240.md
29f1b653-0ade-515c-87f4-43406d431c3b
docs
golang
golang_strings
go1240
47
Cap returns the capacity of the builder's underlying byte slice. It is the total space allocated for the string being built and includes any bytes already written. #### func (\*Builder) [Grow](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/builder.go;l=69) [¶](#Builder.Grow "Go to Builder.Grow") added in go...
large_dataset/raw/docs/golang/strings/strings_go1240.md
5c024853-bdcb-54e1-9d59-5ea78ff08108
docs
golang
golang_strings
go1240
48
#### func (\*Builder) [Reset](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/builder.go;l=53) [¶](#Builder.Reset "Go to Builder.Reset") added in go1.10 ```None func (b *Builder) Reset() ``` Reset resets the [Builder](#Builder) to be empty. #### func (\*Builder) [String](https://cs.opensource.google/go/go/...
large_dataset/raw/docs/golang/strings/strings_go1240.md
f69c0c0f-822b-56a5-bbbc-6ebce0ed6ce5
docs
golang
golang_strings
go1240
49
#### func (\*Builder) [WriteByte](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/builder.go;l=89) [¶](#Builder.WriteByte "Go to Builder.WriteByte") added in go1.10 ```None func (b *Builder) WriteByte(c byte) error ``` WriteByte appends the byte c to b's buffer. The returned error is always nil. #### func ...
large_dataset/raw/docs/golang/strings/strings_go1240.md
053bca06-561b-5942-953b-82d9d8b1fbf0
docs
golang
golang_strings
go1240
50
#### type [Reader](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/reader.go;l=17) [¶](#Reader "Go to Reader") ```None type Reader struct { // contains filtered or unexported fields } ``` A Reader implements the [io.Reader](/io#Reader), [io.ReaderAt](/io#ReaderAt), [io.ByteReader](/io#ByteReader), [io.Byte...
large_dataset/raw/docs/golang/strings/strings_go1240.md
eac8610d-a4c8-5df8-a030-84a371dbac22
docs
golang
golang_strings
go1240
51
#### func (\*Reader) [Len](https://cs.opensource.google/go/go/+/go1.24.0: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.24....
large_dataset/raw/docs/golang/strings/strings_go1240.md
aaa4b54f-a11d-54a1-8519-666f7bcacae9
docs
golang
golang_strings
go1240
52
ReadByte implements the [io.ByteReader](/io#ByteReader) interface. #### func (\*Reader) [ReadRune](https://cs.opensource.google/go/go/+/go1.24.0: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...
large_dataset/raw/docs/golang/strings/strings_go1240.md
28686e37-358b-5757-837f-ac9613db4b4e
docs
golang
golang_strings
go1240
53
#### func (\*Reader) [Size](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/reader.go;l=36) [¶](#Reader.Size "Go to Reader.Size") added in go1.5 ```None func (r *Reader) Size() int64 ``` Size returns the original length of the underlying string. Size is the number of bytes available for reading via [Reader....
large_dataset/raw/docs/golang/strings/strings_go1240.md
8d933ea3-2769-5b4f-a4c0-be45458c16ca
docs
golang
golang_strings
go1240
54
#### func (\*Reader) [WriteTo](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/reader.go;l=137) [¶](#Reader.WriteTo "Go to Reader.WriteTo") added in go1.1 ```None func (r *Reader) WriteTo(w io.Writer) (n int64, err error) ``` WriteTo implements the [io.WriterTo](/io#WriterTo) interface. #### type [Replacer...
large_dataset/raw/docs/golang/strings/strings_go1240.md
4b3cc6c5-1ae0-5888-ac7b-664039352165
docs
golang
golang_strings
go1240
55
comparisons are done in argument order. NewReplacer panics if given an odd number of arguments. Example [¶](#example-NewReplacer "Go to Example") ```None package main import ( "fmt" "strings" ) func main() { r := strings.NewReplacer("<", "&lt;", ">", "&gt;") fmt.Println(r.Replace("This is <b>HTML</b>!")) } ```...
large_dataset/raw/docs/golang/strings/strings_go1240.md
40b69168-42f9-5a80-99eb-90b74f003ae3
docs
golang
golang_sync
go118
0
# Golang - sync Source: https://pkg.go.dev/sync@go1.18 Version: go1.18 ## Documentation [¶](#section-documentation "Go to Documentation") ### Overview [¶](#pkg-overview "Go to Overview") Package sync provides basic synchronization primitives such as mutual exclusion locks. Other than the Once and WaitGroup types, m...
large_dataset/raw/docs/golang/sync/sync_go118.md
fb66cc1c-e258-518f-9d9e-3a6eda07f1d8
docs
golang
golang_sync
go118
1
+ [func (m \*Map) LoadOrStore(key, value any) (actual any, loaded bool)](#Map.LoadOrStore) + [func (m \*Map) Range(f func(key, value any) bool)](#Map.Range) + [func (m \*Map) Store(key, value any)](#Map.Store) * [type Mutex](#Mutex) * + [func (m \*Mutex) Lock()](#Mutex.Lock) + [func (m \*Mutex) TryLock() bool](...
large_dataset/raw/docs/golang/sync/sync_go118.md
771efe17-4e2f-5861-b0df-8eb163c23a5d
docs
golang
golang_sync
go118
2
* + [func (wg \*WaitGroup) Add(delta int)](#WaitGroup.Add) + [func (wg \*WaitGroup) Done()](#WaitGroup.Done) + [func (wg \*WaitGroup) Wait()](#WaitGroup.Wait) ### Examples [¶](#pkg-examples "Go to Examples") * [Once](#example-Once) * [Pool](#example-Pool) * [WaitGroup](#example-WaitGroup) ### Constants [¶](#pkg-...
large_dataset/raw/docs/golang/sync/sync_go118.md
582bb8d5-d5c4-55a6-b542-a4da295dbb8c
docs
golang
golang_sync
go118
3
which must be held when changing the condition and when calling the Wait method. A Cond must not be copied after first use. #### func [NewCond](https://cs.opensource.google/go/go/+/go1.18:src/sync/cond.go;l=32) [¶](#NewCond "Go to NewCond") ```None func NewCond(l Locker) *Cond ``` NewCond returns a new Cond with Lo...
large_dataset/raw/docs/golang/sync/sync_go118.md
149e7aa8-1504-5a8c-a248-86430117a033
docs
golang
golang_sync
go118
4
#### func (\*Cond) [Wait](https://cs.opensource.google/go/go/+/go1.18:src/sync/cond.go;l=52) [¶](#Cond.Wait "Go to Cond.Wait") ```None func (c *Cond) Wait() ``` Wait atomically unlocks c.L and suspends execution of the calling goroutine. After later resuming execution, Wait locks c.L before returning. Unlike in other...
large_dataset/raw/docs/golang/sync/sync_go118.md
622375f0-0c3b-5f0d-b22e-ab0c0ce3864b
docs
golang
golang_sync
go118
5
#### type [Map](https://cs.opensource.google/go/go/+/go1.18:src/sync/map.go;l=27) [¶](#Map "Go to Map") added in go1.9 ```None type Map struct { // contains filtered or unexported fields } ``` Map is like a Go map[interface{}]interface{} but is safe for concurrent use by multiple goroutines without additional lockin...
large_dataset/raw/docs/golang/sync/sync_go118.md
bbf0d550-13aa-5bf5-9d6f-261e1b89813c
docs
golang
golang_sync
go118
6
The zero Map is empty and ready for use. A Map must not be copied after first use. #### func (\*Map) [Delete](https://cs.opensource.google/go/go/+/go1.18:src/sync/map.go;l=293) [¶](#Map.Delete "Go to Map.Delete") added in go1.9 ```None func (m *Map) Delete(key any) ``` Delete deletes the value for a key. #### func ...
large_dataset/raw/docs/golang/sync/sync_go118.md
0b1b711e-a167-5ece-9905-1a7864771dad
docs
golang
golang_sync
go118
7
The loaded result reports whether the key was present. #### func (\*Map) [LoadOrStore](https://cs.opensource.google/go/go/+/go1.18:src/sync/map.go;l=200) [¶](#Map.LoadOrStore "Go to Map.LoadOrStore") added in go1.9 ```None func (m *Map) LoadOrStore(key, value any) (actual any, loaded bool) ``` LoadOrStore returns th...
large_dataset/raw/docs/golang/sync/sync_go118.md
b71a38d6-36c1-5f4c-9a4f-c8a0f090b193
docs
golang
golang_sync
go118
8
is stored or deleted concurrently (including by f), Range may reflect any mapping for that key from any point during the Range call. Range does not block other methods on the receiver; even f itself may call any method on m. Range may be O(N) with the number of elements in the map even if f returns false after a const...
large_dataset/raw/docs/golang/sync/sync_go118.md
a3be156c-2a68-52ee-b378-5491c864bbce
docs
golang
golang_sync
go118
9
#### func (\*Mutex) [Lock](https://cs.opensource.google/go/go/+/go1.18:src/sync/mutex.go;l=72) [¶](#Mutex.Lock "Go to Mutex.Lock") ```None func (m *Mutex) Lock() ``` Lock locks m. If the lock is already in use, the calling goroutine blocks until the mutex is available. #### func (\*Mutex) [TryLock](https://cs.openso...
large_dataset/raw/docs/golang/sync/sync_go118.md
fd2a0d23-e66a-52ff-b73e-a626648425d0
docs
golang
golang_sync
go118
10
It is allowed for one goroutine to lock a Mutex and then arrange for another goroutine to unlock it. #### type [Once](https://cs.opensource.google/go/go/+/go1.18:src/sync/once.go;l=14) [¶](#Once "Go to Once") ```None type Once struct { // contains filtered or unexported fields } ``` Once is an object that will perf...
large_dataset/raw/docs/golang/sync/sync_go118.md
a06c7750-6219-5ae3-aded-ebbe7f48cf0f
docs
golang
golang_sync
go118
11
first time for this instance of Once. In other words, given ```None var once Once ``` if once.Do(f) is called multiple times, only the first call will invoke f, even if f has a different value in each invocation. A new instance of Once is required for each function to execute. Do is intended for initialization that ...
large_dataset/raw/docs/golang/sync/sync_go118.md
f329b673-b3fe-516e-b6b7-16b5cbde5457
docs
golang
golang_sync
go118
12
// It may not be changed concurrently with calls to Get. New func() any // contains filtered or unexported fields } ``` A Pool is a set of temporary objects that may be individually saved and retrieved. Any item stored in the Pool may be removed automatically at any time without notification. If the Pool holds the...
large_dataset/raw/docs/golang/sync/sync_go118.md
e0e94322-e417-59c5-a3b0-1b7bcf8090e0
docs
golang
golang_sync
go118
13
dynamically-sized store of temporary output buffers. The store scales under load (when many goroutines are actively printing) and shrinks when quiescent. On the other hand, a free list maintained as part of a short-lived object is not a suitable use for a Pool, since the overhead does not amortize well in that scenari...
large_dataset/raw/docs/golang/sync/sync_go118.md
dcf2ab48-ed8e-5725-9129-ef4dda03ca90
docs
golang
golang_sync
go118
14
// Replace this with time.Now() in a real logger. b.WriteString(timeNow().UTC().Format(time.RFC3339)) b.WriteByte(' ') b.WriteString(key) b.WriteByte('=') b.WriteString(val) w.Write(b.Bytes()) bufPool.Put(b) } func main() { Log(os.Stdout, "path", "/search?q=flowers") } ``` ```None Output: 2006-01-02T15:04:0...
large_dataset/raw/docs/golang/sync/sync_go118.md
2591167c-c1fc-51ef-9541-2d4ecbda22d9
docs
golang
golang_sync
go118
15
#### func (\*Pool) [Put](https://cs.opensource.google/go/go/+/go1.18:src/sync/pool.go;l=90) [¶](#Pool.Put "Go to Pool.Put") added in go1.3 ```None func (p *Pool) Put(x any) ``` Put adds x to the pool. #### type [RWMutex](https://cs.opensource.google/go/go/+/go1.18:src/sync/rwmutex.go;l=28) [¶](#RWMutex "Go to RWMute...
large_dataset/raw/docs/golang/sync/sync_go118.md
3fff4b94-bc14-5d74-88fa-793c05ec0699
docs
golang
golang_sync
go118
16
#### func (\*RWMutex) [Lock](https://cs.opensource.google/go/go/+/go1.18:src/sync/rwmutex.go;l=133) [¶](#RWMutex.Lock "Go to RWMutex.Lock") ```None func (rw *RWMutex) Lock() ``` Lock locks rw for writing. If the lock is already locked for reading or writing, Lock blocks until the lock is available. #### func (\*RWMu...
large_dataset/raw/docs/golang/sync/sync_go118.md
fa2f67c4-d25e-5e3f-b081-0c731ee06e15
docs
golang
golang_sync
go118
17
#### func (\*RWMutex) [RUnlock](https://cs.opensource.google/go/go/+/go1.18:src/sync/rwmutex.go;l=103) [¶](#RWMutex.RUnlock "Go to RWMutex.RUnlock") ```None func (rw *RWMutex) RUnlock() ``` RUnlock undoes a single RLock call; it does not affect other simultaneous readers. It is a run-time error if rw is not locked fo...
large_dataset/raw/docs/golang/sync/sync_go118.md
7cae4012-d36a-5b4c-a36b-89fe8eafc3fd
docs
golang
golang_sync
go118
18
TryRLock tries to lock rw for reading and reports whether it succeeded. Note that while correct uses of TryRLock do exist, they are rare, and use of TryRLock is often a sign of a deeper problem in a particular use of mutexes. #### func (\*RWMutex) [Unlock](https://cs.opensource.google/go/go/+/go1.18:src/sync/rwmutex....
large_dataset/raw/docs/golang/sync/sync_go118.md
88116671-431e-5951-80a1-7dc80db27cc5
docs
golang
golang_sync
go118
19
The main goroutine calls Add to set the number of goroutines to wait for. Then each of the goroutines runs and calls Done when finished. At the same time, Wait can be used to block until all goroutines have finished. A WaitGroup must not be copied after first use. Example [¶](#example-WaitGroup "Go to Example") This...
large_dataset/raw/docs/golang/sync/sync_go118.md
53dd0c55-65a3-55b7-a1e6-feb9a1bf4cc8
docs
golang
golang_sync
go118
20
Share Format Run #### func (\*WaitGroup) [Add](https://cs.opensource.google/go/go/+/go1.18:src/sync/waitgroup.go;l=59) [¶](#WaitGroup.Add "Go to WaitGroup.Add") ```None func (wg *WaitGroup) Add(delta int) ``` Add adds delta, which may be negative, to the WaitGroup counter. If the counter becomes zero, all goroutines...
large_dataset/raw/docs/golang/sync/sync_go118.md
c3f1c407-f0c1-5d4f-91de-2256404cfebb
docs
golang
golang_sync
go118
21
#### func (\*WaitGroup) [Done](https://cs.opensource.google/go/go/+/go1.18:src/sync/waitgroup.go;l=104) [¶](#WaitGroup.Done "Go to WaitGroup.Done") ```None func (wg *WaitGroup) Done() ``` Done decrements the WaitGroup counter by one. #### func (\*WaitGroup) [Wait](https://cs.opensource.google/go/go/+/go1.18:src/sync...
large_dataset/raw/docs/golang/sync/sync_go118.md
da9223ae-3b8f-58cf-b8f7-3834f68eccb8
docs
golang
golang_sync
go119
0
# Golang - sync Source: https://pkg.go.dev/sync@go1.19 Version: go1.19 ## Documentation [¶](#section-documentation "Go to Documentation") ### Overview [¶](#pkg-overview "Go to Overview") Package sync provides basic synchronization primitives such as mutual exclusion locks. Other than the Once and WaitGroup types, m...
large_dataset/raw/docs/golang/sync/sync_go119.md
8e16ae41-f0bc-5c01-9e54-fc6addc7dcf2
docs
golang
golang_sync
go119
1
+ [func (m \*Map) LoadOrStore(key, value any) (actual any, loaded bool)](#Map.LoadOrStore) + [func (m \*Map) Range(f func(key, value any) bool)](#Map.Range) + [func (m \*Map) Store(key, value any)](#Map.Store) * [type Mutex](#Mutex) * + [func (m \*Mutex) Lock()](#Mutex.Lock) + [func (m \*Mutex) TryLock() bool](...
large_dataset/raw/docs/golang/sync/sync_go119.md
f6bc47b5-cf5f-551e-a8dd-9f9e48aa5d18
docs
golang
golang_sync
go119
2
* + [func (wg \*WaitGroup) Add(delta int)](#WaitGroup.Add) + [func (wg \*WaitGroup) Done()](#WaitGroup.Done) + [func (wg \*WaitGroup) Wait()](#WaitGroup.Wait) ### Examples [¶](#pkg-examples "Go to Examples") * [Once](#example-Once) * [Pool](#example-Pool) * [WaitGroup](#example-WaitGroup) ### Constants [¶](#pkg-...
large_dataset/raw/docs/golang/sync/sync_go119.md
9d4759ff-80d1-5ae0-9f6d-55ef24e719f6
docs
golang
golang_sync
go119
3
which must be held when changing the condition and when calling the Wait method. A Cond must not be copied after first use. In the terminology of the Go memory model, Cond arranges that a call to Broadcast or Signal “synchronizes before” any Wait call that it unblocks. For many simple use cases, users will be better...
large_dataset/raw/docs/golang/sync/sync_go119.md
c156416b-9c61-5eb9-9a82-8b7bbc21d61b
docs
golang
golang_sync
go119
4
#### func (\*Cond) [Broadcast](https://cs.opensource.google/go/go/+/go1.19:src/sync/cond.go;l=90) [¶](#Cond.Broadcast "Go to Cond.Broadcast") ```None func (c *Cond) Broadcast() ``` Broadcast wakes all goroutines waiting on c. It is allowed but not required for the caller to hold c.L during the call. #### func (\*Co...
large_dataset/raw/docs/golang/sync/sync_go119.md
cc393340-67ac-5a72-a136-5a90117fac4b
docs
golang
golang_sync
go119
5
of the calling goroutine. After later resuming execution, Wait locks c.L before returning. Unlike in other systems, Wait cannot return unless awoken by Broadcast or Signal. Because c.L is not locked when Wait first resumes, the caller typically cannot assume that the condition is true when Wait returns. Instead, the c...
large_dataset/raw/docs/golang/sync/sync_go119.md
4dde2d5b-2b58-5ebf-8b3f-5219c75a1e7d
docs
golang
golang_sync
go119
6
by multiple goroutines without additional locking or coordination. Loads, stores, and deletes run in amortized constant time. The Map type is specialized. Most code should use a plain Go map instead, with separate locking or coordination, for better type safety and to make it easier to maintain other invariants along ...
large_dataset/raw/docs/golang/sync/sync_go119.md