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 |
|---|---|---|---|---|---|---|---|
14654fd4-974f-5d06-932c-479a85c7706e | docs | golang | golang_maps | go1240 | 1 | * [func Insert[Map ~map[K]V, K comparable, V any](m Map, seq iter.Seq2[K, V])](#Insert)
* [func Keys[Map ~map[K]V, K comparable, V any](m Map) iter.Seq[K]](#Keys)
* [func Values[Map ~map[K]V, K comparable, V any](m Map) iter.Seq[V]](#Values)
### Examples [¶](#pkg-examples "Go to Examples")
* [All](#example-All)
* [Cl... | large_dataset/raw/docs/golang/maps/maps_go1240.md |
3c1d7a79-7300-56a6-8b1c-29d91c2c1a19 | docs | golang | golang_maps | go1240 | 2 | All returns an iterator over key-value pairs from m.
The iteration order is not specified and is not guaranteed
to be the same from one call to the next.
Example [¶](#example-All "Go to Example")
```None
package main
import (
"fmt"
"maps"
)
func main() {
m1 := map[string]int{
"one": 1,
"two": 2,
}
m2 := ma... | large_dataset/raw/docs/golang/maps/maps_go1240.md |
0e243d97-7497-517b-b079-57633f51586a | docs | golang | golang_maps | go1240 | 3 | m3 := map[string][]int{
"key": {1, 2, 3},
}
m4 := maps.Clone(m3)
fmt.Println(m4["key"][0])
m4["key"][0] = 100
fmt.Println(m3["key"][0])
fmt.Println(m4["key"][0])
}
```
```None
Output:
1
100
1
100
100
```
Share
Format
Run
#### func [Collect](https://cs.opensource.google/go/go/+/go1.24.0:src/maps/iter.go;l=... | large_dataset/raw/docs/golang/maps/maps_go1240.md |
cd2dc6b1-039b-5542-9afa-eaa7d7c17c25 | docs | golang | golang_maps | go1240 | 4 | #### func [Copy](https://cs.opensource.google/go/go/+/go1.24.0:src/maps/maps.go;l=62) [¶](#Copy "Go to Copy")
```None
func Copy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2)
```
Copy copies all key/value pairs in src adding them to dst.
When a key in src is already present in dst,
the value in dst wi... | large_dataset/raw/docs/golang/maps/maps_go1240.md |
5a726714-8548-50cc-8adb-c0b89d698981 | docs | golang | golang_maps | go1240 | 5 | m2 is: map[one:100 two:2]
m4 is: map[one:[1 2 3] two:[4 5 6]]
m3 is: map[one:[100 2 3] two:[4 5 6]]
m4 is: map[one:[100 2 3] two:[4 5 6]]
```
Share
Format
Run
#### func [DeleteFunc](https://cs.opensource.google/go/go/+/go1.24.0:src/maps/maps.go;l=69) [¶](#DeleteFunc "Go to DeleteFunc")
```None
func DeleteFunc[M ~map... | large_dataset/raw/docs/golang/maps/maps_go1240.md |
7544c3b3-80a2-57ac-9149-28c81e01612e | docs | golang | golang_maps | go1240 | 6 | #### func [Equal](https://cs.opensource.google/go/go/+/go1.24.0:src/maps/maps.go;l=17) [¶](#Equal "Go to Equal")
```None
func Equal[M1, M2 ~map[K]V, K, V comparable](m1 M1, m2 M2) bool
```
Equal reports whether two maps contain the same key/value pairs.
Values are compared using ==.
Example [¶](#example-Equal "Go to... | large_dataset/raw/docs/golang/maps/maps_go1240.md |
f99abeff-116f-5b10-a814-536c03e651d8 | docs | golang | golang_maps | go1240 | 7 | EqualFunc is like Equal, but compares values using eq.
Keys are still compared with ==.
Example [¶](#example-EqualFunc "Go to Example")
```None
package main
import (
"fmt"
"maps"
"strings"
)
func main() {
m1 := map[int]string{
1: "one",
10: "Ten",
1000: "THOUSAND",
}
m2 := map[int][]byte{
1: [... | large_dataset/raw/docs/golang/maps/maps_go1240.md |
9174ab4c-9341-5cdb-82dd-8016298bbe0d | docs | golang | golang_maps | go1240 | 8 | "slices"
)
func main() {
m1 := map[int]string{
1000: "THOUSAND",
}
s1 := []string{"zero", "one", "two", "three"}
maps.Insert(m1, slices.All(s1))
fmt.Println("m1 is:", m1)
}
```
```None
Output:
m1 is: map[0:zero 1:one 2:two 3:three 1000:THOUSAND]
```
Share
Format
Run
#### func [Keys](https://cs.opensource.g... | large_dataset/raw/docs/golang/maps/maps_go1240.md |
91994b4c-a7c6-5fc6-bf48-06a44484beea | docs | golang | golang_maps | go1240 | 9 | #### func [Values](https://cs.opensource.google/go/go/+/go1.24.0:src/maps/iter.go;l=38) [¶](#Values "Go to Values") added in go1.23.0
```None
func Values[Map ~map[K]V, K comparable, V any](m Map) iter.Seq[V]
```
Values returns an iterator over values in m.
The iteration order is not specified and is not guaranteed
to... | large_dataset/raw/docs/golang/maps/maps_go1240.md |
81415a73-fa6c-52b4-91dd-b6834b1a68bf | docs | golang | golang_strings | go118 | 0 | # Golang - strings
Source: https://pkg.go.dev/strings@go1.18
Version: go1.18
## 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_go118.md |
ebdc5d1b-1a82-5589-85ef-dd715bb370d0 | docs | golang | golang_strings | go118 | 1 | * [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](#IndexByte)
* [func IndexFunc(s string, f func(rune) bool) int](#IndexFunc)
* [func IndexRune(s string, r rune) int](#IndexRune)
*... | large_dataset/raw/docs/golang/strings/strings_go118.md |
8461acc9-e0c0-5c07-ac94-32a69bf28996 | docs | golang | golang_strings | go118 | 2 | * [func SplitN(s, sep string, n int) []string](#SplitN)
* [func Title(s string) string](#Title)deprecated
* [func ToLower(s string) string](#ToLower)
* [func ToLowerSpecial(c unicode.SpecialCase, s string) string](#ToLowerSpecial)
* [func ToTitle(s string) string](#ToTitle)
* [func ToTitleSpecial(c unicode.SpecialCase,... | large_dataset/raw/docs/golang/strings/strings_go118.md |
8a48a9a9-6d4d-5fd4-b84c-464890fcb98e | docs | golang | golang_strings | go118 | 3 | * [func TrimSuffix(s, suffix string) string](#TrimSuffix)
* [type Builder](#Builder)
* + [func (b \*Builder) Cap() int](#Builder.Cap)
+ [func (b \*Builder) Grow(n int)](#Builder.Grow)
+ [func (b \*Builder) Len() int](#Builder.Len)
+ [func (b \*Builder) Reset()](#Builder.Reset)
+ [func (b \*Builder) String() str... | large_dataset/raw/docs/golang/strings/strings_go118.md |
5b3a7d89-1bdf-56e3-b5a3-3aae76bffae6 | docs | golang | golang_strings | go118 | 4 | + [func (r \*Reader) ReadRune() (ch rune, size int, err error)](#Reader.ReadRune)
+ [func (r \*Reader) Reset(s string)](#Reader.Reset)
+ [func (r \*Reader) Seek(offset int64, whence int) (int64, error)](#Reader.Seek)
+ [func (r \*Reader) Size() int64](#Reader.Size)
+ [func (r \*Reader) UnreadByte() error](#Re... | large_dataset/raw/docs/golang/strings/strings_go118.md |
c4f60b78-b7b0-5020-b38e-3ac5dcb813a8 | docs | golang | golang_strings | go118 | 5 | * [EqualFold](#example-EqualFold)
* [Fields](#example-Fields)
* [FieldsFunc](#example-FieldsFunc)
* [HasPrefix](#example-HasPrefix)
* [HasSuffix](#example-HasSuffix)
* [Index](#example-Index)
* [IndexAny](#example-IndexAny)
* [IndexByte](#example-IndexByte)
* [IndexFunc](#example-IndexFunc)
* [IndexRune](#example-Index... | large_dataset/raw/docs/golang/strings/strings_go118.md |
c8422085-4ead-5dd9-b17e-9ce992eba3a6 | docs | golang | golang_strings | go118 | 6 | * [ToUpperSpecial](#example-ToUpperSpecial)
* [Trim](#example-Trim)
* [TrimFunc](#example-TrimFunc)
* [TrimLeft](#example-TrimLeft)
* [TrimLeftFunc](#example-TrimLeftFunc)
* [TrimPrefix](#example-TrimPrefix)
* [TrimRight](#example-TrimRight)
* [TrimRightFunc](#example-TrimRightFunc)
* [TrimSpace](#example-TrimSpace)
* ... | large_dataset/raw/docs/golang/strings/strings_go118.md |
ba4a36e3-ddbd-5e19-b850-c5c36ffae966 | docs | golang | golang_strings | go118 | 7 | overuse of Clone can make programs use more memory.
Clone should typically be used only rarely, and only when
profiling indicates that it is needed.
For strings of length zero the string "" will be returned
and no allocation is made.
#### func [Compare](https://cs.opensource.google/go/go/+/go1.18:src/strings/compare.g... | large_dataset/raw/docs/golang/strings/strings_go118.md |
0e80fef5-3c0b-5b5f-a97c-1c2af969f045 | docs | golang | golang_strings | go118 | 8 | #### func [Contains](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=61) [¶](#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_go118.md |
475301b3-cf7b-572c-8f14-eb61f2f802bb | docs | golang | golang_strings | go118 | 9 | 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_go118.md |
2acef6e3-819d-5ff8-a3b2-1a2651c17cbd | docs | golang | golang_strings | go118 | 10 | #### func [Count](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=41) [¶](#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 s.... | large_dataset/raw/docs/golang/strings/strings_go118.md |
3d2603c2-edad-56ec-bf60-4817cb03f81c | docs | golang | golang_strings | go118 | 11 | 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_go118.md |
57e1fc0c-42a9-5e22-9efb-3b5606e2aaa4 | docs | golang | golang_strings | go118 | 12 | fmt.Println(strings.EqualFold("Go", "go"))
}
```
```None
Output:
true
```
Share
Format
Run
#### func [Fields](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=324) [¶](#Fields "Go to Fields")
```None
func Fields(s string) []string
```
Fields splits the string s around each instance of one or ... | large_dataset/raw/docs/golang/strings/strings_go118.md |
373fee9c-9325-521d-b193-67001c4c3a3c | docs | golang | golang_strings | go118 | 13 | 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_go118.md |
22376208-5452-5abb-bc0c-45ea8352d6b5 | docs | golang | golang_strings | go118 | 14 | fmt.Println(strings.HasPrefix("Gopher", "Go"))
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.18:src/strings/strings.go;l=453) [¶](#HasSuffix "Go t... | large_dataset/raw/docs/golang/strings/strings_go118.md |
496895af-4fc9-5a76-9f4e-4bf1992252e8 | docs | golang | golang_strings | go118 | 15 | #### func [Index](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=1097) [¶](#Index "Go to Index")
```None
func Index(s, substr string) int
```
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
p... | large_dataset/raw/docs/golang/strings/strings_go118.md |
9f7737a1-5e5a-54fb-b73c-b6936a85d21e | docs | golang | golang_strings | go118 | 16 | fmt.Println(strings.IndexAny("crwth", "aeiouy"))
}
```
```None
Output:
2
-1
```
Share
Format
Run
#### func [IndexByte](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=113) [¶](#IndexByte "Go to IndexByte") added in go1.2
```None
func IndexByte(s string, c byte) int
```
IndexByte returns the ... | large_dataset/raw/docs/golang/strings/strings_go118.md |
f4b8825f-ccb4-599d-8797-5a09d23e06e9 | docs | golang | golang_strings | go118 | 17 | Example [¶](#example-IndexFunc "Go to Example")
```None
package main
import (
"fmt"
"strings"
"unicode"
)
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
`... | large_dataset/raw/docs/golang/strings/strings_go118.md |
925c7e03-f039-54d9-83c7-1d7fae4775ff | docs | golang | golang_strings | go118 | 18 | #### func [Join](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=425) [¶](#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 resulti... | large_dataset/raw/docs/golang/strings/strings_go118.md |
4b5371fd-a78b-5468-b6d2-12a489ea962b | docs | golang | golang_strings | go118 | 19 | 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.18:src/strings/strings.go;l=175) [¶](#LastIndexAny "Go to LastIndexAny")
```None
func LastInd... | large_dataset/raw/docs/golang/strings/strings_go118.md |
de6cb083-fea4-5bee-9e62-a692ddcd4fda | docs | golang | golang_strings | go118 | 20 | #### func [LastIndexByte](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=225) [¶](#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_go118.md |
59d064fe-3d98-5168-9144-364434eece76 | docs | golang | golang_strings | go118 | 21 | ```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_go118.md |
720eb264-079f-57e3-bab0-908124d0e873 | docs | golang | golang_strings | go118 | 22 | fmt.Println(strings.Map(rot13, "'Twas brillig and the slithy gopher..."))
}
```
```None
Output:
'Gjnf oevyyvt naq gur fyvgul tbcure...
```
Share
Format
Run
#### func [Repeat](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=523) [¶](#Repeat "Go to Repeat")
```None
func Repeat(s string, count i... | large_dataset/raw/docs/golang/strings/strings_go118.md |
60af87a2-f96a-5e2f-b9fb-c71524e920bd | docs | golang | golang_strings | go118 | 23 | If old is empty, it matches at the beginning of the string
and after each UTF-8 sequence, yielding up to k+1 replacements
for a k-rune string.
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... | large_dataset/raw/docs/golang/strings/strings_go118.md |
f2e33c78-f183-5c3e-9343-8106d57eb43c | docs | golang | golang_strings | go118 | 24 | ```None
package main
import (
"fmt"
"strings"
)
func main() {
fmt.Println(strings.ReplaceAll("oink oink oink", "oink", "moo"))
}
```
```None
Output:
moo moo moo
```
Share
Format
Run
#### func [Split](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=303) [¶](#Split "Go to Split")
```None
fu... | large_dataset/raw/docs/golang/strings/strings_go118.md |
271c3b94-f508-5e43-ac18-2e5321b14504 | docs | golang | golang_strings | go118 | 25 | fmt.Printf("%q\n", strings.Split("a man a plan a canal panama", "a "))
fmt.Printf("%q\n", strings.Split(" xyz ", ""))
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 [Split... | large_dataset/raw/docs/golang/strings/strings_go118.md |
5c8281db-f6b5-5b46-a5d3-36492919dfe4 | docs | golang | golang_strings | go118 | 26 | fmt.Printf("%q\n", strings.SplitAfter("a,b,c", ","))
}
```
```None
Output:
["a," "b," "c"]
```
Share
Format
Run
#### func [SplitAfterN](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=287) [¶](#SplitAfterN "Go to SplitAfterN")
```None
func SplitAfterN(s, sep string, n int) []string
```
Split... | large_dataset/raw/docs/golang/strings/strings_go118.md |
581d0975-bac1-5f4b-b4ea-9f4fbbd7a6ad | docs | golang | golang_strings | go118 | 27 | #### func [SplitN](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=275) [¶](#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_go118.md |
c2f0efb1-b7a3-597c-8dbc-f9c6f925e80b | docs | golang | golang_strings | go118 | 28 | #### func [Title](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=715) 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_go118.md |
724a2628-0dc8-5ee8-9bf3-9adfe47aa459 | docs | golang | golang_strings | go118 | 29 | 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.18:src/strings/strings.go;l=625) [¶](#ToLower... | large_dataset/raw/docs/golang/strings/strings_go118.md |
7c7fd29a-9a12-5395-b3c9-e48ad3826c24 | docs | golang | golang_strings | go118 | 30 | #### func [ToTitle](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=615) [¶](#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_go118.md |
bf8a8e2e-8995-5baf-bd84-4c982411ed84 | docs | golang | golang_strings | go118 | 31 | 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_go118.md |
15298c9d-f938-59c4-8f85-40076501e705 | docs | golang | golang_strings | go118 | 32 | 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_go118.md |
f2c8cfdb-f00a-5b25-aea0-c81baa173940 | docs | golang | golang_strings | go118 | 33 | 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_go118.md |
fcd43737-7482-5917-87cb-4a24dbc55e83 | docs | golang | golang_strings | go118 | 34 | #### func [TrimLeft](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=846) [¶](#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_go118.md |
f736b2a8-acb7-5cf9-9a32-8411c44de6e8 | docs | golang | golang_strings | go118 | 35 | 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.18:src/strings/strings.go;l=975) [¶](#TrimPrefix "Go to ... | large_dataset/raw/docs/golang/strings/strings_go118.md |
ba898ee6-80e8-5072-896a-66edbd36e428 | docs | golang | golang_strings | go118 | 36 | #### func [TrimRight](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=894) [¶](#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_go118.md |
d7bf64ce-3172-5121-9204-c33453623dd8 | docs | golang | golang_strings | go118 | 37 | 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.18:src/strings/strings.go;l=940) [¶](#Trim... | large_dataset/raw/docs/golang/strings/strings_go118.md |
84c6eeae-7773-5c14-a79e-1471528b01fe | docs | golang | golang_strings | go118 | 38 | 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_go118.md |
e6100430-31eb-5b2c-b022-8d9e4d3143c0 | docs | golang | golang_strings | go118 | 39 | fmt.Println(b.String())
}
```
```None
Output:
3...2...1...ignition
```
Share
Format
Run
#### func (\*Builder) [Cap](https://cs.opensource.google/go/go/+/go1.18:src/strings/builder.go;l=56) [¶](#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_go118.md |
032e3ae1-3d43-5f7c-9135-295a03a97ac2 | docs | golang | golang_strings | go118 | 40 | #### func (\*Builder) [Len](https://cs.opensource.google/go/go/+/go1.18:src/strings/builder.go;l=51) [¶](#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_go118.md |
5018dc7a-b8ec-5043-9adb-008cd8e01aab | docs | golang | golang_strings | go118 | 41 | 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.18:src/strings/builder.go;l=95) [¶](#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_go118.md |
4e7d9780-c130-52fc-b2af-85b005f567a0 | docs | golang | golang_strings | go118 | 42 | 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.18: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_go118.md |
01d05e87-1115-58b6-84a5-c3551ba37c53 | docs | golang | golang_strings | go118 | 43 | #### func (\*Reader) [Len](https://cs.opensource.google/go/go/+/go1.18: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.18:sr... | large_dataset/raw/docs/golang/strings/strings_go118.md |
e02cb926-9efe-527b-b9a1-7ffed0ddb999 | docs | golang | golang_strings | go118 | 44 | #### func (\*Reader) [ReadRune](https://cs.opensource.google/go/go/+/go1.18: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_go118.md |
88dcc104-09df-5766-b0cd-c082eb5e036d | docs | golang | golang_strings | go118 | 45 | 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.18:src/strings/reader.go;l=77) [¶](... | large_dataset/raw/docs/golang/strings/strings_go118.md |
5581ff68-bcee-5f00-863e-ae0b8d982bbd | docs | golang | golang_strings | go118 | 46 | #### type [Replacer](https://cs.opensource.google/go/go/+/go1.18: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_go118.md |
1973bdfd-f772-54be-a447-2d78f865ee94 | docs | golang | golang_strings | go118 | 47 | ```None
Output:
This is <b>HTML</b>!
```
Share
Format
Run
#### func (\*Replacer) [Replace](https://cs.opensource.google/go/go/+/go1.18: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_go118.md |
666f3542-2b7a-5072-9167-6b0fbd1c09c1 | docs | golang | golang_strings | go119 | 0 | # Golang - strings
Source: https://pkg.go.dev/strings@go1.19
Version: go1.19
## 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_go119.md |
efff8953-4e3d-5765-9569-852a798d1d2f | docs | golang | golang_strings | go119 | 1 | * [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](#IndexByte)
* [func IndexFunc(s string, f func(rune) bool) int](#IndexFunc)
* [func IndexRune(s string, r rune) int](#IndexRune)
*... | large_dataset/raw/docs/golang/strings/strings_go119.md |
400c1809-a993-564b-8843-b5fc87a58793 | docs | golang | golang_strings | go119 | 2 | * [func SplitN(s, sep string, n int) []string](#SplitN)
* [func Title(s string) string](#Title)deprecated
* [func ToLower(s string) string](#ToLower)
* [func ToLowerSpecial(c unicode.SpecialCase, s string) string](#ToLowerSpecial)
* [func ToTitle(s string) string](#ToTitle)
* [func ToTitleSpecial(c unicode.SpecialCase,... | large_dataset/raw/docs/golang/strings/strings_go119.md |
b3430b38-6cd6-5917-8cb7-d703fe745444 | docs | golang | golang_strings | go119 | 3 | * [func TrimSuffix(s, suffix string) string](#TrimSuffix)
* [type Builder](#Builder)
* + [func (b \*Builder) Cap() int](#Builder.Cap)
+ [func (b \*Builder) Grow(n int)](#Builder.Grow)
+ [func (b \*Builder) Len() int](#Builder.Len)
+ [func (b \*Builder) Reset()](#Builder.Reset)
+ [func (b \*Builder) String() str... | large_dataset/raw/docs/golang/strings/strings_go119.md |
985523ed-a458-53c7-a4de-167a4e2b764c | docs | golang | golang_strings | go119 | 4 | + [func (r \*Reader) ReadRune() (ch rune, size int, err error)](#Reader.ReadRune)
+ [func (r \*Reader) Reset(s string)](#Reader.Reset)
+ [func (r \*Reader) Seek(offset int64, whence int) (int64, error)](#Reader.Seek)
+ [func (r \*Reader) Size() int64](#Reader.Size)
+ [func (r \*Reader) UnreadByte() error](#Re... | large_dataset/raw/docs/golang/strings/strings_go119.md |
1276cef5-daa4-5d45-8b90-6646b939e943 | docs | golang | golang_strings | go119 | 5 | * [EqualFold](#example-EqualFold)
* [Fields](#example-Fields)
* [FieldsFunc](#example-FieldsFunc)
* [HasPrefix](#example-HasPrefix)
* [HasSuffix](#example-HasSuffix)
* [Index](#example-Index)
* [IndexAny](#example-IndexAny)
* [IndexByte](#example-IndexByte)
* [IndexFunc](#example-IndexFunc)
* [IndexRune](#example-Index... | large_dataset/raw/docs/golang/strings/strings_go119.md |
dc3e8a62-30e3-5269-b2d3-0fcb9d613c53 | docs | golang | golang_strings | go119 | 6 | * [ToUpperSpecial](#example-ToUpperSpecial)
* [Trim](#example-Trim)
* [TrimFunc](#example-TrimFunc)
* [TrimLeft](#example-TrimLeft)
* [TrimLeftFunc](#example-TrimLeftFunc)
* [TrimPrefix](#example-TrimPrefix)
* [TrimRight](#example-TrimRight)
* [TrimRightFunc](#example-TrimRightFunc)
* [TrimSpace](#example-TrimSpace)
* ... | large_dataset/raw/docs/golang/strings/strings_go119.md |
c1a5e8b4-6eae-541d-8825-954b18fe306b | docs | golang | golang_strings | go119 | 7 | overuse of Clone can make programs use more memory.
Clone should typically be used only rarely, and only when
profiling indicates that it is needed.
For strings of length zero the string "" will be returned
and no allocation is made.
#### func [Compare](https://cs.opensource.google/go/go/+/go1.19:src/strings/compare.g... | large_dataset/raw/docs/golang/strings/strings_go119.md |
e0fdde12-53f9-5c9c-98f5-d76efd716ca6 | docs | golang | golang_strings | go119 | 8 | #### func [Contains](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=61) [¶](#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_go119.md |
73a8b2e3-f23d-5b93-82f7-5543a3a52ec9 | docs | golang | golang_strings | go119 | 9 | 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_go119.md |
501cc581-7db7-5889-9b8d-3d99551ec5c5 | docs | golang | golang_strings | go119 | 10 | #### func [Count](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=41) [¶](#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 s.... | large_dataset/raw/docs/golang/strings/strings_go119.md |
db784fd9-e1a4-5c50-b673-39bfae06e12c | docs | golang | golang_strings | go119 | 11 | 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_go119.md |
b56b2e4a-6124-50b5-9ba8-ecbc9313c9ee | docs | golang | golang_strings | go119 | 12 | fmt.Println(strings.EqualFold("Go", "go"))
fmt.Println(strings.EqualFold("AB", "ab")) // true because comparison uses simple case-folding
fmt.Println(strings.EqualFold("ß", "ss")) // false because comparison does not use full case-folding
}
```
```None
Output:
true
true
false
```
Share
Format
Run
#### func [Fie... | large_dataset/raw/docs/golang/strings/strings_go119.md |
1880e1b1-a8ce-530b-ac4a-26939b6cb2db | docs | golang | golang_strings | go119 | 13 | #### func [FieldsFunc](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=384) [¶](#FieldsFunc "Go to FieldsFunc")
```None
func FieldsFunc(s string, f func(rune) bool) []string
```
FieldsFunc splits the string s at each run of Unicode code points c satisfying f(c)
and returns an array of slices of s... | large_dataset/raw/docs/golang/strings/strings_go119.md |
05257db1-0e5d-5540-aa11-b40c40fb1239 | docs | golang | golang_strings | go119 | 14 | #### func [HasPrefix](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=453) [¶](#HasPrefix "Go to HasPrefix")
```None
func HasPrefix(s, prefix string) bool
```
HasPrefix tests whether the string s begins with prefix.
Example [¶](#example-HasPrefix "Go to Example")
```None
package main
import (
... | large_dataset/raw/docs/golang/strings/strings_go119.md |
d3e8855c-abf5-547c-9efe-612b4641a71a | docs | golang | golang_strings | go119 | 15 | fmt.Println(strings.HasSuffix("Amigo", "Ami"))
fmt.Println(strings.HasSuffix("Amigo", ""))
}
```
```None
Output:
true
false
false
true
```
Share
Format
Run
#### func [Index](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=1103) [¶](#Index "Go to Index")
```None
func Index(s, substr string) i... | large_dataset/raw/docs/golang/strings/strings_go119.md |
8ff03c49-12bf-588a-8967-66152289972c | docs | golang | golang_strings | go119 | 16 | Example [¶](#example-IndexAny "Go to Example")
```None
package main
import (
"fmt"
"strings"
)
func main() {
fmt.Println(strings.IndexAny("chicken", "aeiouy"))
fmt.Println(strings.IndexAny("crwth", "aeiouy"))
}
```
```None
Output:
2
-1
```
Share
Format
Run
#### func [IndexByte](https://cs.opensource.google/g... | large_dataset/raw/docs/golang/strings/strings_go119.md |
a2c6cedb-5457-57a6-9550-f7056b6dda98 | docs | golang | golang_strings | go119 | 17 | #### func [IndexFunc](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=768) [¶](#IndexFunc "Go to IndexFunc")
```None
func IndexFunc(s string, f func(rune) bool) int
```
IndexFunc returns the index into s of the first Unicode
code point satisfying f(c), or -1 if none do.
Example [¶](#example-Inde... | large_dataset/raw/docs/golang/strings/strings_go119.md |
ceb71c3a-e8cd-5105-8321-88a2b69efea6 | docs | golang | golang_strings | go119 | 18 | Example [¶](#example-IndexRune "Go to Example")
```None
package main
import (
"fmt"
"strings"
)
func main() {
fmt.Println(strings.IndexRune("chicken", 'k'))
fmt.Println(strings.IndexRune("chicken", 'd'))
}
```
```None
Output:
4
-1
```
Share
Format
Run
#### func [Join](https://cs.opensource.google/go/go/+/go1... | large_dataset/raw/docs/golang/strings/strings_go119.md |
1878cfd4-00c0-5fa8-a8e5-1aa1c33c2b85 | docs | golang | golang_strings | go119 | 19 | #### func [LastIndex](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=76) [¶](#LastIndex "Go to LastIndex")
```None
func LastIndex(s, substr string) int
```
LastIndex returns the index of the last instance of substr in s, or -1 if substr is not present in s.
Example [¶](#example-LastIndex "Go to... | large_dataset/raw/docs/golang/strings/strings_go119.md |
351f83dd-0801-5839-999a-2b837214f788 | docs | golang | golang_strings | go119 | 20 |
import (
"fmt"
"strings"
)
func main() {
fmt.Println(strings.LastIndexAny("go gopher", "go"))
fmt.Println(strings.LastIndexAny("go gopher", "rodent"))
fmt.Println(strings.LastIndexAny("go gopher", "fail"))
}
```
```None
Output:
4
8
-1
```
Share
Format
Run
#### func [LastIndexByte](https://cs.opensource.googl... | large_dataset/raw/docs/golang/strings/strings_go119.md |
1f0ba345-b68f-5088-a67c-3efadba3a30e | docs | golang | golang_strings | go119 | 21 | #### func [LastIndexFunc](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=774) [¶](#LastIndexFunc "Go to LastIndexFunc")
```None
func LastIndexFunc(s string, f func(rune) bool) int
```
LastIndexFunc returns the index into s of the last
Unicode code point satisfying f(c), or -1 if none do.
Exampl... | large_dataset/raw/docs/golang/strings/strings_go119.md |
cb9835a1-1b12-5730-b7cd-b24b9e460e91 | docs | golang | golang_strings | go119 | 22 | dropped from the string with no replacement.
Example [¶](#example-Map "Go to Example")
```None
package main
import (
"fmt"
"strings"
)
func main() {
rot13 := func(r rune) rune {
switch {
case r >= 'A' && r <= 'Z':
return 'A' + (r-'A'+13)%26
case r >= 'a' && r <= 'z':
return 'a' + (r-'a'+13)%26
}
... | large_dataset/raw/docs/golang/strings/strings_go119.md |
ba692a9d-2b3b-5188-813b-a1fdbd68997b | docs | golang | golang_strings | go119 | 23 | Format
Run
#### func [Replace](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=1003) [¶](#Replace "Go to Replace")
```None
func Replace(s, old, new string, n int) string
```
Replace returns a copy of the string s with the first n
non-overlapping instances of old replaced by new.
If old is empty,... | large_dataset/raw/docs/golang/strings/strings_go119.md |
ae0e8e10-f095-5962-ad04-fb8ba0005c22 | docs | golang | golang_strings | go119 | 24 | #### func [ReplaceAll](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=1042) [¶](#ReplaceAll "Go to ReplaceAll") added in go1.12
```None
func ReplaceAll(s, old, new string) string
```
ReplaceAll returns a copy of the string s with all
non-overlapping instances of old replaced by new.
If old is em... | large_dataset/raw/docs/golang/strings/strings_go119.md |
82d858bc-5580-5a1c-bd76-4dd0aea31efc | docs | golang | golang_strings | go119 | 25 | If s does not contain sep and sep is not empty, Split returns a
slice of length 1 whose only element is s.
If sep is empty, Split splits after each UTF-8 sequence. If both s
and sep are empty, Split returns an empty slice.
It is equivalent to SplitN with a count of -1.
To split around the first instance of a separat... | large_dataset/raw/docs/golang/strings/strings_go119.md |
3308371a-aad4-5549-987c-3835c4c734f5 | docs | golang | golang_strings | go119 | 26 | SplitAfter slices s into all substrings after each instance of sep and
returns a slice of those substrings.
If s does not contain sep and sep is not empty, SplitAfter returns
a slice of length 1 whose only element is s.
If sep is empty, SplitAfter splits after each UTF-8 sequence. If
both s and sep are empty, SplitAf... | large_dataset/raw/docs/golang/strings/strings_go119.md |
33b50567-69e2-5727-ba46-4932253a60e0 | docs | golang | golang_strings | go119 | 27 | n > 0: at most n substrings; the last substring will be the unsplit remainder.
n == 0: the result is nil (zero substrings)
n < 0: all substrings
```
Edge cases for s and sep (for example, empty strings) are handled
as described in the documentation for SplitAfter.
Example [¶](#example-SplitAfterN "Go to Example")
``... | large_dataset/raw/docs/golang/strings/strings_go119.md |
efe1e3e8-944c-5595-94c1-17aaf55fbc23 | docs | golang | golang_strings | go119 | 28 | Edge cases for s and sep (for example, empty strings) are handled
as described in the documentation for Split.
To split around the first instance of a separator, see Cut.
Example [¶](#example-SplitN "Go to Example")
```None
package main
import (
"fmt"
"strings"
)
func main() {
fmt.Printf("%q\n", strings.SplitN(... | large_dataset/raw/docs/golang/strings/strings_go119.md |
bad2d9a0-5260-5071-bed4-77fdfdcd55d2 | docs | golang | golang_strings | go119 | 29 | // Compare this example to the ToTitle example.
fmt.Println(strings.Title("her royal highness"))
fmt.Println(strings.Title("loud noises"))
fmt.Println(strings.Title("хлеб"))
}
```
```None
Output:
Her Royal Highness
Loud Noises
Хлеб
```
Share
Format
Run
#### func [ToLower](https://cs.opensource.google/go/go/+/go... | large_dataset/raw/docs/golang/strings/strings_go119.md |
3f86c6f8-975d-57de-9091-5e2321e7cd12 | docs | golang | golang_strings | go119 | 30 | lower case using the case mapping specified by c.
Example [¶](#example-ToLowerSpecial "Go to Example")
```None
package main
import (
"fmt"
"strings"
"unicode"
)
func main() {
fmt.Println(strings.ToLowerSpecial(unicode.TurkishCase, "Önnek İş"))
}
```
```None
Output:
önnek iş
```
Share
Format
Run
#### func [T... | large_dataset/raw/docs/golang/strings/strings_go119.md |
f62abcde-31b3-54e7-bf3f-016e2ea1f864 | docs | golang | golang_strings | go119 | 31 | #### func [ToTitleSpecial](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=636) [¶](#ToTitleSpecial "Go to ToTitleSpecial")
```None
func ToTitleSpecial(c unicode.SpecialCase, s string) string
```
ToTitleSpecial returns a copy of the string s with all Unicode letters mapped to their
Unicode title ... | large_dataset/raw/docs/golang/strings/strings_go119.md |
12eb2471-9038-5fbe-b69b-fe56a00bb62d | docs | golang | golang_strings | go119 | 32 | "fmt"
"strings"
)
func main() {
fmt.Println(strings.ToUpper("Gopher"))
}
```
```None
Output:
GOPHER
```
Share
Format
Run
#### func [ToUpperSpecial](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=624) [¶](#ToUpperSpecial "Go to ToUpperSpecial")
```None
func ToUpperSpecial(c unicode.Special... | large_dataset/raw/docs/golang/strings/strings_go119.md |
a7acef23-582e-55b6-8f12-23354d522f7e | docs | golang | golang_strings | go119 | 33 | ToValidUTF8 returns a copy of the string s with each run of invalid UTF-8 byte sequences
replaced by the replacement string, which may be empty.
#### func [Trim](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=834) [¶](#Trim "Go to Trim")
```None
func Trim(s, cutset string) string
```
Trim retur... | large_dataset/raw/docs/golang/strings/strings_go119.md |
f3d7afba-acce-5e27-af56-0c49843ac8f7 | docs | golang | golang_strings | go119 | 34 | package main
import (
"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/+/... | large_dataset/raw/docs/golang/strings/strings_go119.md |
e88d301d-eac2-5cf6-9da1-f8162b465a37 | docs | golang | golang_strings | go119 | 35 | #### func [TrimLeftFunc](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=739) [¶](#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.
Exa... | large_dataset/raw/docs/golang/strings/strings_go119.md |
56c699c1-58a7-5791-ab65-155fc3cc0923 | docs | golang | golang_strings | go119 | 36 | ```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 [TrimRight](https://cs.opensource.google/go/go/+/go1.19:sr... | large_dataset/raw/docs/golang/strings/strings_go119.md |
fcef5a0a-855f-5c0e-b1a0-458fe4d79656 | docs | golang | golang_strings | go119 | 37 | #### func [TrimRightFunc](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=749) [¶](#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) removed... | large_dataset/raw/docs/golang/strings/strings_go119.md |
20495f2a-caa5-5561-a347-1c29702d8cc8 | docs | golang | golang_strings | go119 | 38 | 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.19:src/strings/strings.go;l=990) [¶](#TrimSuffix "Go to TrimSuffix") added in go1.1
... | large_dataset/raw/docs/golang/strings/strings_go119.md |
c5e6990e-7920-5fd6-904c-d9e9d15d0646 | docs | golang | golang_strings | go119 | 39 | #### type [Builder](https://cs.opensource.google/go/go/+/go1.19:src/strings/builder.go;l=15) [¶](#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 Write methods.
It minimizes memory copying. Th... | large_dataset/raw/docs/golang/strings/strings_go119.md |
efc2a73c-93da-58b8-9aec-2dc5494c68fb | docs | golang | golang_strings | go119 | 40 | total space allocated for the string being built and includes any bytes
already written.
#### func (\*Builder) [Grow](https://cs.opensource.google/go/go/+/go1.19:src/strings/builder.go;l=76) [¶](#Builder.Grow "Go to Builder.Grow") added in go1.10
```None
func (b *Builder) Grow(n int)
```
Grow grows b's capacity, if ... | large_dataset/raw/docs/golang/strings/strings_go119.md |
99142782-dbe1-507e-8434-9201150d5c95 | docs | golang | golang_strings | go119 | 41 | #### func (\*Builder) [String](https://cs.opensource.google/go/go/+/go1.19:src/strings/builder.go;l=47) [¶](#Builder.String "Go to Builder.String") added in go1.10
```None
func (b *Builder) String() string
```
String returns the accumulated string.
#### func (\*Builder) [Write](https://cs.opensource.google/go/go/+/g... | large_dataset/raw/docs/golang/strings/strings_go119.md |
0c642a3c-7cc0-5c5d-8eaf-0b72fc69ed60 | docs | golang | golang_strings | go119 | 42 | #### func (\*Builder) [WriteRune](https://cs.opensource.google/go/go/+/go1.19:src/strings/builder.go;l=104) [¶](#Builder.WriteRune "Go to Builder.WriteRune") added in go1.10
```None
func (b *Builder) WriteRune(r rune) (int, error)
```
WriteRune appends the UTF-8 encoding of Unicode code point r to b's buffer.
It retu... | large_dataset/raw/docs/golang/strings/strings_go119.md |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.