Tweaks to other samples to accommodate strings-and-runes
Add a link to the range sample, and remove partial mentions of this topic in string-functions since it's now covered well in strings-and-runes
This commit is contained in:
@@ -35,17 +35,4 @@ func main() {
|
||||
p("ToLower: ", s.ToLower("TEST"))
|
||||
p("ToUpper: ", s.ToUpper("test"))
|
||||
p()
|
||||
|
||||
// Not part of `strings`, but worth mentioning here, are
|
||||
// the mechanisms for getting the length of a string in
|
||||
// bytes and getting a byte by index.
|
||||
p("Len: ", len("hello"))
|
||||
p("Char:", "hello"[1])
|
||||
}
|
||||
|
||||
// Note that `len` and indexing above work at the byte level.
|
||||
// Go uses UTF-8 encoded strings, so this is often useful
|
||||
// as-is. If you're working with potentially multi-byte
|
||||
// characters you'll want to use encoding-aware operations.
|
||||
// See [strings, bytes, runes and characters in Go](https://blog.golang.org/strings)
|
||||
// for more information.
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
33b15b8c999ba65564b965b96cbfeadac0d1637d
|
||||
fZ_FqN5WlSz
|
||||
2201eba7e3b9339a6e700a4faa9b085c43dd1ed2
|
||||
pE_KNt12Zv9
|
||||
|
||||
@@ -11,6 +11,3 @@ Replace: f0o
|
||||
Split: [a b c d e]
|
||||
ToLower: test
|
||||
ToUpper: TEST
|
||||
|
||||
Len: 5
|
||||
Char: 101
|
||||
|
||||
Reference in New Issue
Block a user