Skip to content

Commit 31d882f

Browse files
committed
Reto #4 - go
1 parent fc59325 commit 31d882f

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"strings"
6+
)
7+
8+
func main() {
9+
/*
10+
String Functions
11+
*/
12+
13+
var word string = "hello, Go"
14+
15+
fmt.Println(strings.Contains(word, "hello"))
16+
fmt.Println(strings.Count(word, "l"))
17+
fmt.Println(strings.Index(word, "Go"))
18+
fmt.Println(strings.LastIndex(word, "Go"))
19+
fmt.Println(strings.Repeat(word, 2))
20+
fmt.Println(strings.Replace(word, "Go", "Go!", 1))
21+
fmt.Println(strings.ToLower(word))
22+
fmt.Println(strings.ToUpper(word))
23+
fmt.Println(strings.Trim(word, "eho"))
24+
fmt.Println(strings.TrimSpace(word))
25+
}

0 commit comments

Comments
 (0)