Created
March 16, 2024 14:18
-
-
Save xvbnm48/dc247a01abe6e0f7d823407d9a52b42c to your computer and use it in GitHub Desktop.
strings count, untuk menghitung berapa kali sebuah karakter muncul dari sebuah string
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"strings" | |
) | |
func main() { | |
fmt.Println(strings.Count("hira dazzle", "ra")) | |
// hasilnya adalah 1 karena "ra" hanya muncul 1 kali | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment