Created
March 16, 2024 14:23
-
-
Save xvbnm48/42a27af6de3b0b88a47a45693b3bbb8a to your computer and use it in GitHub Desktop.
strings hasPrefix, untuk mengecek awalan dari sebuah string itu sama atau tidak dari apa yang kita mau cari
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.HasPrefix("hira dazzle", "hira")) | |
// hasilnya adalah true karena "hira" adalah awalan dari "hira dazzle" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment