diff --git a/main.go b/main.go index c8a856b..4433889 100644 --- a/main.go +++ b/main.go @@ -50,6 +50,7 @@ import ( "golesson/maps" "golesson/pointers" "golesson/slices" + "golesson/string_functions" "golesson/structs" "golesson/variables" "time" @@ -125,4 +126,5 @@ func main() { interfaces.Demo3() error_handling.Demo2() fmt.Println(error_handling.GuessIt2(102)) + string_functions.Demo1() } diff --git a/string_functions/demo1.go b/string_functions/demo1.go new file mode 100644 index 0000000..395bb19 --- /dev/null +++ b/string_functions/demo1.go @@ -0,0 +1,26 @@ +package string_functions + +//alias +import ( + "fmt" + s "strings" +) + +// case sensitive +// ascii +func Demo1() { + name := "Engin" + fmt.Println(s.Count(name, "g")) + fmt.Println(s.Contains(name, "g")) + fmt.Println(s.Index(name, "g")) + result := s.Index(name, "E") + + if result != -1{ + fmt.Println("E letter exists") + }else{ + fmt.Println("E letter does not exist") + } + + fmt.Println(s.ToLower(name)) + fmt.Println(s.ToUpper(name)) +}