Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
28
Task/String-case/Go/string-case-1.go
Normal file
28
Task/String-case/Go/string-case-1.go
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"unicode"
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
func main() {
|
||||
show("alphaBETA")
|
||||
show("alpha BETA")
|
||||
// Three digraphs that should render similar to DZ, Lj, and nj.
|
||||
show("DŽLjnj")
|
||||
// Unicode apostrophe in third word.
|
||||
show("o'hare O'HARE o’hare don't")
|
||||
}
|
||||
|
||||
func show(s string) {
|
||||
fmt.Println("\nstring: ",
|
||||
s, " len:", utf8.RuneCountInString(s), "runes") // DZLjnj
|
||||
fmt.Println("All upper case: ", strings.ToUpper(s)) // DZLJNJ
|
||||
fmt.Println("All lower case: ", strings.ToLower(s)) // dzljnj
|
||||
fmt.Println("All title case: ", strings.ToTitle(s)) // DzLjNj
|
||||
fmt.Println("Title words: ", strings.Title(s)) // Dzljnj
|
||||
fmt.Println("Swapping case: ", // DzLjNJ
|
||||
strings.Map(unicode.SimpleFold, s))
|
||||
}
|
||||
14
Task/String-case/Go/string-case-2.go
Normal file
14
Task/String-case/Go/string-case-2.go
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func main() {
|
||||
a := "Stroßbùrri"
|
||||
b := "ĥåçýджк"
|
||||
fmt.Println(strings.ToUpper(a))
|
||||
fmt.Println(strings.ToUpper(b))
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue