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 |
|---|---|---|---|---|---|---|---|
79304d0a-01a7-53b6-baab-776bfdf99c2a | docs | golang | golang_strings | go1210 | 44 | total space allocated for the string being built and includes any bytes
already written.
#### func (\*Builder) [Grow](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/builder.go;l=77) [¶](#Builder.Grow "Go to Builder.Grow") added in go1.10
```None
func (b *Builder) Grow(n int)
```
Grow grows b's capacity, i... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
e8180eca-4a6a-5a3d-8390-3678723720fc | docs | golang | golang_strings | go1210 | 45 | #### func (\*Builder) [String](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/builder.go;l=48) [¶](#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/+... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
f931e267-fc27-505a-bc19-f137cae2fcac | docs | golang | golang_strings | go1210 | 46 | #### func (\*Builder) [WriteRune](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/builder.go;l=105) [¶](#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 re... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
ed699905-fa19-5eb2-b2d6-2e6a0dd1d68d | docs | golang | golang_strings | go1210 | 47 | 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.21.0:src/strings/reader.go;l=160) [¶](#NewReader "Go to NewReader")
```None
func NewReader(... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
a61c4394-7306-56f6-a2a0-f4d0b2861c8f | docs | golang | golang_strings | go1210 | 48 | #### func (\*Reader) [ReadAt](https://cs.opensource.google/go/go/+/go1.21.0: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.opensou... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
3fbf44ab-4424-56ac-8abd-383ae42d273a | docs | golang | golang_strings | go1210 | 49 | #### func (\*Reader) [Reset](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/reader.go;l=156) [¶](#Reader.Reset "Go to Reader.Reset") added in go1.7
```None
func (r *Reader) Reset(s string)
```
Reset resets the Reader to be reading from s.
#### func (\*Reader) [Seek](https://cs.opensource.google/go/go/+/go... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
fdc7f696-1f37-53eb-9e6f-7b4cc2f4cd97 | docs | golang | golang_strings | go1210 | 50 | #### func (\*Reader) [UnreadByte](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/reader.go;l=77) [¶](#Reader.UnreadByte "Go to Reader.UnreadByte")
```None
func (r *Reader) UnreadByte() error
```
UnreadByte implements the io.ByteScanner interface.
#### func (\*Reader) [UnreadRune](https://cs.opensource.goo... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
601f481b-bf33-52bf-b868-804990faf661 | docs | golang | golang_strings | go1210 | 51 | #### type [Replacer](https://cs.opensource.google/go/go/+/go1.21.0: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_go1210.md |
f6e9aad5-9a74-59a4-8e6e-2d6a657ebb1a | docs | golang | golang_strings | go1210 | 52 | ```
```None
Output:
This is <b>HTML</b>!
```
Share
Format
Run
#### func (\*Replacer) [Replace](https://cs.opensource.google/go/go/+/go1.21.0: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 ... | large_dataset/raw/docs/golang/strings/strings_go1210.md |
e22478b5-c401-5b68-9584-1411e9455e3e | docs | golang | golang_strings | go1220 | 0 | # Golang - strings
Source: https://pkg.go.dev/strings@go1.22.0
Version: go1.22.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_go1220.md |
042e5736-6768-5c96-adb7-5099c06b0785 | docs | golang | golang_strings | go1220 | 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_go1220.md |
b7dbf6d3-3ffd-58bf-bf5b-9f08d9c2132b | docs | golang | golang_strings | go1220 | 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_go1220.md |
d0c04060-75d4-55b8-aa15-b988f89ac40c | docs | golang | golang_strings | go1220 | 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_go1220.md |
74999f90-0ac1-5e1f-8d4c-596cc44ab954 | docs | golang | golang_strings | go1220 | 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_go1220.md |
3c27750d-59ec-5ac3-a02b-70dad613f5f9 | docs | golang | golang_strings | go1220 | 5 | ### Examples [¶](#pkg-examples "Go to Examples")
* [Builder](#example-Builder)
* [Clone](#example-Clone)
* [Compare](#example-Compare)
* [Contains](#example-Contains)
* [ContainsAny](#example-ContainsAny)
* [ContainsFunc](#example-ContainsFunc)
* [ContainsRune](#example-ContainsRune)
* [Count](#example-Count)
* [Cut](... | large_dataset/raw/docs/golang/strings/strings_go1220.md |
002b0278-e8bc-5e63-9b60-50d7e6cd8604 | docs | golang | golang_strings | go1220 | 6 | * [Replace](#example-Replace)
* [ReplaceAll](#example-ReplaceAll)
* [Split](#example-Split)
* [SplitAfter](#example-SplitAfter)
* [SplitAfterN](#example-SplitAfterN)
* [SplitN](#example-SplitN)
* [Title](#example-Title)
* [ToLower](#example-ToLower)
* [ToLowerSpecial](#example-ToLowerSpecial)
* [ToTitle](#example-ToTit... | large_dataset/raw/docs/golang/strings/strings_go1220.md |
c42bfc86-4623-51ec-a660-94eb7a5ed083 | docs | golang | golang_strings | go1220 | 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.22.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_go1220.md |
e2331201-a9cd-5b05-81c0-7440032cf93e | docs | golang | golang_strings | go1220 | 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.22.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_go1220.md |
81785b19-3181-5547-b457-accf4b0f8d05 | docs | golang | golang_strings | go1220 | 9 | #### func [Contains](https://cs.opensource.google/go/go/+/go1.22.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_go1220.md |
98789717-1ad5-5769-88d9-e8abf1859352 | docs | golang | golang_strings | go1220 | 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_go1220.md |
c6a45213-e1f6-5283-a39b-1aa1d393e7de | docs | golang | golang_strings | go1220 | 11 | #### func [ContainsRune](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=70) [¶](#ContainsRune "Go to ContainsRune")
```None
func ContainsRune(s string, r rune) bool
```
ContainsRune reports whether the Unicode code point r is within s.
Example [¶](#example-ContainsRune "Go to Example")
```No... | large_dataset/raw/docs/golang/strings/strings_go1220.md |
402bafc0-4e3f-56c0-b0b9-d0ed345851a1 | docs | golang | golang_strings | go1220 | 12 | Example [¶](#example-Count "Go to Example")
```None
package main
import (
"fmt"
"strings"
)
func main() {
fmt.Println(strings.Count("cheese", "e"))
fmt.Println(strings.Count("five", "")) // before & after each rune
}
```
```None
Output:
3
5
```
Share
Format
Run
#### func [Cut](https://cs.opensource.google/go... | large_dataset/raw/docs/golang/strings/strings_go1220.md |
da928d9f-c8ef-57bb-841f-b762d4a61603 | docs | golang | golang_strings | go1220 | 13 | show("Gopher", "Badger")
}
```
```None
Output:
Cut("Gopher", "Go") = "", "pher", true
Cut("Gopher", "ph") = "Go", "er", true
Cut("Gopher", "er") = "Goph", "", true
Cut("Gopher", "Badger") = "Gopher", "", false
```
Share
Format
Run
#### func [CutPrefix](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/stri... | large_dataset/raw/docs/golang/strings/strings_go1220.md |
5abb01a3-ef4f-574a-a7a6-5fac17a730e9 | docs | golang | golang_strings | go1220 | 14 | CutPrefix("Gopher", "Go") = "pher", true
CutPrefix("Gopher", "ph") = "Gopher", false
```
Share
Format
Run
#### func [CutSuffix](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=1295) [¶](#CutSuffix "Go to CutSuffix") added in go1.20
```None
func CutSuffix(s, suffix string) (before string, found... | large_dataset/raw/docs/golang/strings/strings_go1220.md |
eb278590-fb8c-51e7-9bec-7e6ad4953b1d | docs | golang | golang_strings | go1220 | 15 | #### func [EqualFold](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=1106) [¶](#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_go1220.md |
e6c54a44-6536-55bc-bec5-b01ac61805ca | docs | golang | golang_strings | go1220 | 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_go1220.md |
dcfe17e2-37c9-5cf7-a83c-eba2a01427d6 | docs | golang | golang_strings | go1220 | 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_go1220.md |
45db627e-29a9-5fe2-8eae-90c5f7de64dc | docs | golang | golang_strings | go1220 | 18 | #### func [HasSuffix](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=467) [¶](#HasSuffix "Go to HasSuffix")
```None
func HasSuffix(s, suffix string) bool
```
HasSuffix reports whether the string s ends with suffix.
Example [¶](#example-HasSuffix "Go to Example")
```None
package main
import ... | large_dataset/raw/docs/golang/strings/strings_go1220.md |
09008ac0-d859-52f2-b725-fc981fbfdc5a | docs | golang | golang_strings | go1220 | 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.22.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_go1220.md |
f6907b9b-c4d3-58e5-bc15-d0c0d5bcdc84 | docs | golang | golang_strings | go1220 | 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_go1220.md |
de2a1f56-e4cf-5c62-8710-2ff8aa4c42a4 | docs | golang | golang_strings | go1220 | 21 |
Share
Format
Run
#### func [IndexRune](https://cs.opensource.google/go/go/+/go1.22.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_go1220.md |
927aefe0-43a4-5fbd-b0a5-263fb5bb5a31 | docs | golang | golang_strings | go1220 | 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.22.0:src/strin... | large_dataset/raw/docs/golang/strings/strings_go1220.md |
882b5138-4394-5aaa-9b4b-1e96a193fff8 | docs | golang | golang_strings | go1220 | 23 | #### func [LastIndexAny](https://cs.opensource.google/go/go/+/go1.22.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_go1220.md |
46e27d39-1e42-5064-b6be-3cf455addb0f | docs | golang | golang_strings | go1220 | 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_go1220.md |
fef05e93-1cd1-518b-a3c4-d56cd8c5ecd4 | docs | golang | golang_strings | go1220 | 25 | Format
Run
#### func [Map](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=474) [¶](#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_go1220.md |
9166bb33-b8d7-53d6-a3c6-ef47e9cbf5e0 | docs | golang | golang_strings | go1220 | 26 | #### func [Repeat](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=537) [¶](#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_go1220.md |
8f8dc839-2f82-5b8b-89d1-d3fc85cc5a47 | docs | golang | golang_strings | go1220 | 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_go1220.md |
2bc62ffe-2b4d-51cd-bb76-553a73694742 | docs | golang | golang_strings | go1220 | 28 | ```None
Output:
moo moo moo
```
Share
Format
Run
#### func [Split](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=307) [¶](#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_go1220.md |
c6579bcd-f6f2-5173-8922-88f874a14f22 | docs | golang | golang_strings | go1220 | 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.22.0:src/strings/strings.go;l=319) [¶](#SplitAfter "Go to SplitAfter")
```None
func SplitAfter(s, sep string) []string
```
SplitAft... | large_dataset/raw/docs/golang/strings/strings_go1220.md |
b0db678c-ad62-51aa-9661-7c9e97a4b7c5 | docs | golang | golang_strings | go1220 | 30 | #### func [SplitAfterN](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=291) [¶](#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_go1220.md |
c3b00516-0e11-5a0c-a6c3-a5d0e493f299 | docs | golang | golang_strings | go1220 | 31 | #### func [SplitN](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=278) [¶](#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_go1220.md |
ef5bf455-f755-5569-816d-4cbde47158ca | docs | golang | golang_strings | go1220 | 32 | #### func [Title](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=777) 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_go1220.md |
d9bccc1e-dfeb-5ded-8cc7-7af35917d2d7 | docs | golang | golang_strings | go1220 | 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.22.0:src/strings/strings.go;l=687) [¶](#ToLow... | large_dataset/raw/docs/golang/strings/strings_go1220.md |
16a1933b-999c-587e-b2ac-053bb889aa01 | docs | golang | golang_strings | go1220 | 34 | #### func [ToTitle](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=677) [¶](#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_go1220.md |
0cd8df3e-4f26-5ee0-aa16-3815d2b2b51d | docs | golang | golang_strings | go1220 | 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_go1220.md |
c14746ef-2567-5eed-9b56-81b5f4ee2378 | docs | golang | golang_strings | go1220 | 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_go1220.md |
fe73c8c0-75ba-50d8-91a3-872b8e2a14cd | docs | golang | golang_strings | go1220 | 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.22.0:src/strings/strings.go;l=891) [¶](#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_go1220.md |
b9d6d6d7-fa87-5ccf-b988-38b90b229869 | docs | golang | golang_strings | go1220 | 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.22.0:src/strings/st... | large_dataset/raw/docs/golang/strings/strings_go1220.md |
0c8b4e12-5e56-5211-83f1-6779ff38d1dc | docs | golang | golang_strings | go1220 | 39 | #### func [TrimLeftFunc](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=796) [¶](#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_go1220.md |
d7b73ea0-d03c-5ae6-a4e3-329b7cde6242 | docs | golang | golang_strings | go1220 | 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_go1220.md |
82264a6c-e75c-58ee-98ca-6a6ed9859e32 | docs | golang | golang_strings | go1220 | 41 | #### func [TrimRightFunc](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=806) [¶](#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_go1220.md |
d78c5e39-e2e1-5f7c-b667-86f6ad396bcb | docs | golang | golang_strings | go1220 | 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.22.0:src/strings/strings.go;l=1047) [¶](#TrimSuffix "Go to TrimSuffix") added in go1.... | large_dataset/raw/docs/golang/strings/strings_go1220.md |
6c64e66d-8126-58f8-a38f-7660c8ecee62 | docs | golang | golang_strings | go1220 | 43 | ### Types [¶](#pkg-types "Go to Types")
#### type [Builder](https://cs.opensource.google/go/go/+/go1.22.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 [Bu... | large_dataset/raw/docs/golang/strings/strings_go1220.md |
cabcc529-6fe6-5cd7-8b3c-7b696bce40b5 | docs | golang | golang_strings | go1220 | 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.22.0:src/strings/builder.go;l=77) [¶](#Builder.Grow "Go to Builder.Grow") added in go... | large_dataset/raw/docs/golang/strings/strings_go1220.md |
0abc7620-1c38-5dde-8ee2-9a5f4df7593d | docs | golang | golang_strings | go1220 | 45 | #### func (\*Builder) [Reset](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/builder.go;l=61) [¶](#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_go1220.md |
71739f74-d2d6-5735-9dc7-b99290da0fb7 | docs | golang | golang_strings | go1220 | 46 | #### func (\*Builder) [WriteByte](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/builder.go;l=97) [¶](#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_go1220.md |
63a91a60-09ee-57c7-93ab-da5e16075f0e | docs | golang | golang_strings | go1220 | 47 | #### type [Reader](https://cs.opensource.google/go/go/+/go1.22.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_go1220.md |
ef9c85f1-6733-5cf6-bdfb-a9f8550b2cdf | docs | golang | golang_strings | go1220 | 48 | #### func (\*Reader) [Len](https://cs.opensource.google/go/go/+/go1.22.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.22.... | large_dataset/raw/docs/golang/strings/strings_go1220.md |
0ecc0b03-be59-5263-9059-57b55fcb5e9c | docs | golang | golang_strings | go1220 | 49 | ReadByte implements the [io.ByteReader](/io#ByteReader) interface.
#### func (\*Reader) [ReadRune](https://cs.opensource.google/go/go/+/go1.22.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_go1220.md |
ab184c91-3138-5f38-8290-e26040b2bf8e | docs | golang | golang_strings | go1220 | 50 | #### func (\*Reader) [Size](https://cs.opensource.google/go/go/+/go1.22.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_go1220.md |
72818c67-b900-576e-8e7a-f803d060a271 | docs | golang | golang_strings | go1220 | 51 | #### func (\*Reader) [WriteTo](https://cs.opensource.google/go/go/+/go1.22.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_go1220.md |
6570534a-160c-5c3e-a99c-b8e3f032ed90 | docs | golang | golang_strings | go1220 | 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("<", "<", ">", ">")
fmt.Println(r.Replace("This is <b>HTML</b>!"))
}
```... | large_dataset/raw/docs/golang/strings/strings_go1220.md |
0ce80e1e-7d05-5b74-b325-c3a95313ff9b | docs | golang | golang_strings | go1230 | 0 | # Golang - strings
Source: https://pkg.go.dev/strings@go1.23.0
Version: go1.23.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_go1230.md |
ae2df218-ab79-5832-a5a4-a8d00dfc8d30 | docs | golang | golang_strings | go1230 | 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_go1230.md |
c8a8c56c-f737-5bed-9343-121fb4e4cbc1 | docs | golang | golang_strings | go1230 | 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_go1230.md |
1f765d32-b270-53c9-9791-8cfbd9cfcb0d | docs | golang | golang_strings | go1230 | 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_go1230.md |
8b811955-0104-585e-bd1c-f67bbc3e6df1 | docs | golang | golang_strings | go1230 | 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_go1230.md |
88b06356-4ee7-5505-8e26-3155983f656d | docs | golang | golang_strings | go1230 | 5 | ### Examples [¶](#pkg-examples "Go to Examples")
* [Builder](#example-Builder)
* [Clone](#example-Clone)
* [Compare](#example-Compare)
* [Contains](#example-Contains)
* [ContainsAny](#example-ContainsAny)
* [ContainsFunc](#example-ContainsFunc)
* [ContainsRune](#example-ContainsRune)
* [Count](#example-Count)
* [Cut](... | large_dataset/raw/docs/golang/strings/strings_go1230.md |
e49d0144-65e9-5e20-a1bc-2aef32c94ccd | docs | golang | golang_strings | go1230 | 6 | * [Replace](#example-Replace)
* [ReplaceAll](#example-ReplaceAll)
* [Split](#example-Split)
* [SplitAfter](#example-SplitAfter)
* [SplitAfterN](#example-SplitAfterN)
* [SplitN](#example-SplitN)
* [Title](#example-Title)
* [ToLower](#example-ToLower)
* [ToLowerSpecial](#example-ToLowerSpecial)
* [ToTitle](#example-ToTit... | large_dataset/raw/docs/golang/strings/strings_go1230.md |
48a3b79e-0b36-5235-9df5-7f24fb9d0a81 | docs | golang | golang_strings | go1230 | 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.23.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_go1230.md |
813eba96-8c24-57db-9eda-1ed2cfe826e0 | docs | golang | golang_strings | go1230 | 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.23.0:src/strings/compare.go;l=15) [¶](#Compare "Go to Compare") added in go1.5
```None
func Compare(a, b string) int
```
Compare returns... | large_dataset/raw/docs/golang/strings/strings_go1230.md |
6ffcfc82-f462-5472-968b-40dbb7914be8 | docs | golang | golang_strings | go1230 | 9 | #### func [Contains](https://cs.opensource.google/go/go/+/go1.23.0: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_go1230.md |
8683d4d4-d4b6-5116-9ca7-1f02bf0f8ca0 | docs | golang | golang_strings | go1230 | 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_go1230.md |
f86dc3d0-cbf6-56d5-9788-363f48200c0b | docs | golang | golang_strings | go1230 | 11 | #### func [ContainsRune](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=71) [¶](#ContainsRune "Go to ContainsRune")
```None
func ContainsRune(s string, r rune) bool
```
ContainsRune reports whether the Unicode code point r is within s.
Example [¶](#example-ContainsRune "Go to Example")
```No... | large_dataset/raw/docs/golang/strings/strings_go1230.md |
b5790bd4-351a-5910-90f6-1ef2fbdc26e1 | docs | golang | golang_strings | go1230 | 12 | Example [¶](#example-Count "Go to Example")
```None
package main
import (
"fmt"
"strings"
)
func main() {
fmt.Println(strings.Count("cheese", "e"))
fmt.Println(strings.Count("five", "")) // before & after each rune
}
```
```None
Output:
3
5
```
Share
Format
Run
#### func [Cut](https://cs.opensource.google/go... | large_dataset/raw/docs/golang/strings/strings_go1230.md |
4143e5b0-1b2e-5298-8fff-2261a3c333bd | docs | golang | golang_strings | go1230 | 13 | show("Gopher", "Badger")
}
```
```None
Output:
Cut("Gopher", "Go") = "", "pher", true
Cut("Gopher", "ph") = "Go", "er", true
Cut("Gopher", "er") = "Goph", "", true
Cut("Gopher", "Badger") = "Gopher", "", false
```
Share
Format
Run
#### func [CutPrefix](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/stri... | large_dataset/raw/docs/golang/strings/strings_go1230.md |
209c2c6e-aed7-591f-8393-f1465d31de4b | docs | golang | golang_strings | go1230 | 14 | CutPrefix("Gopher", "Go") = "pher", true
CutPrefix("Gopher", "ph") = "Gopher", false
```
Share
Format
Run
#### func [CutSuffix](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=1244) [¶](#CutSuffix "Go to CutSuffix") added in go1.20
```None
func CutSuffix(s, suffix string) (before string, found... | large_dataset/raw/docs/golang/strings/strings_go1230.md |
bc0b52d7-7d8d-51de-9478-77811fe76658 | docs | golang | golang_strings | go1230 | 15 | #### func [EqualFold](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=1137) [¶](#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_go1230.md |
2860e207-6104-5d97-a690-0cc2608cad47 | docs | golang | golang_strings | go1230 | 16 | characters, as defined by [unicode.IsSpace](/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 ... | large_dataset/raw/docs/golang/strings/strings_go1230.md |
c2bc4b33-2296-5111-94f2-ef98d1949aab | docs | golang | golang_strings | go1230 | 17 | package main
import (
"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 ... | large_dataset/raw/docs/golang/strings/strings_go1230.md |
81c819ec-2f8e-568f-8527-50e8abdf5ddf | docs | golang | golang_strings | go1230 | 18 | #### func [HasSuffix](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=466) [¶](#HasSuffix "Go to HasSuffix")
```None
func HasSuffix(s, suffix string) bool
```
HasSuffix reports whether the string s ends with suffix.
Example [¶](#example-HasSuffix "Go to Example")
```None
package main
import ... | large_dataset/raw/docs/golang/strings/strings_go1230.md |
527e046e-a4a3-55ef-9767-8374b1bd4b52 | docs | golang | golang_strings | go1230 | 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.23.0:src/strings/strings.go;l=146) [¶](#IndexAny "Go to IndexAny")
```None
func IndexAny(s, chars string) int
```... | large_dataset/raw/docs/golang/strings/strings_go1230.md |
ac9d242a-1cd8-534c-b3ef-345c02e302ca | docs | golang | golang_strings | go1230 | 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_go1230.md |
5976ac4a-4a14-57db-83e6-df9667e94074 | docs | golang | golang_strings | go1230 | 21 |
Share
Format
Run
#### func [IndexRune](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=126) [¶](#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_go1230.md |
717172a1-2554-5c75-94cd-6bde907bd9ee | docs | golang | golang_strings | go1230 | 22 | string sep is placed between elements in the resulting string.
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 [La... | large_dataset/raw/docs/golang/strings/strings_go1230.md |
43606a61-bb30-5e8f-b66e-121689aa8fb1 | docs | golang | golang_strings | go1230 | 23 | #### func [LastIndexAny](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=180) [¶](#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_go1230.md |
e9d6a5c8-fc70-5cd8-8d23-53d4a53a2a02 | docs | golang | golang_strings | go1230 | 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_go1230.md |
f7e828b4-ca9b-560a-b125-8f5c3f28deaa | docs | golang | golang_strings | go1230 | 25 | Format
Run
#### func [Map](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=473) [¶](#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_go1230.md |
635b19a4-826e-59fe-bd44-11b5b1a9f2fe | docs | golang | golang_strings | go1230 | 26 | #### func [Repeat](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=557) [¶](#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_go1230.md |
8eb2525e-0642-5b41-959c-2f1657b3d523 | docs | golang | golang_strings | go1230 | 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_go1230.md |
3edc4059-864c-5c4f-9585-011f54ee2d06 | docs | golang | golang_strings | go1230 | 28 | ```None
Output:
moo moo moo
```
Share
Format
Run
#### func [Split](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=306) [¶](#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_go1230.md |
cd0a130f-2678-5ba4-832c-e953cfd69712 | docs | golang | golang_strings | go1230 | 29 | 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.23.0:src/strings/strings.go;l=318) [¶](#SplitAfter "Go to SplitAfter")
... | large_dataset/raw/docs/golang/strings/strings_go1230.md |
61e5381a-2ddc-5d5a-99a0-d74df4f9ccb4 | docs | golang | golang_strings | go1230 | 30 | #### func [SplitAfterN](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=290) [¶](#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_go1230.md |
3e7c95be-a930-5157-80b0-74cb4bbb44a1 | docs | golang | golang_strings | go1230 | 31 | #### func [SplitN](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=278) [¶](#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_go1230.md |
b992eadd-5355-54cd-ab0f-f9a19ff761eb | docs | golang | golang_strings | go1230 | 32 | #### func [Title](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=814) 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_go1230.md |
7eea4eec-374f-599c-85b2-36a0898447a3 | docs | golang | golang_strings | go1230 | 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.23.0:src/strings/strings.go;l=724) [¶](#ToLow... | large_dataset/raw/docs/golang/strings/strings_go1230.md |
6116f9a8-082e-5ffc-9899-3f17fe66b08a | docs | golang | golang_strings | go1230 | 34 | #### func [ToTitle](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=714) [¶](#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_go1230.md |
c906ee56-0551-52bc-9324-ad285302d5df | docs | golang | golang_strings | go1230 | 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_go1230.md |
cfc5f069-a902-5401-b5bc-48b746d48754 | docs | golang | golang_strings | go1230 | 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_go1230.md |
4bb3ddf8-37e4-54a2-992e-b568d6b1e96b | docs | golang | golang_strings | go1230 | 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.23.0:src/strings/strings.go;l=928) [¶](#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_go1230.md |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.