fork download
  1. package main
  2.  
  3. import (
  4. "fmt"
  5. "unicode/utf8"
  6. )
  7.  
  8. func show(a string) {
  9. fmt.Printf("counting: '%s', \tgot: %d\n",
  10. a, utf8.RuneCountInString(a))
  11. }
  12.  
  13. func main(){
  14. show("état")
  15. show("ábécé")
  16. show("маля́р")
  17. show("יָּמִֽין")
  18. show("देव")
  19. show("द्ध्र्य")
  20. show("世界")
  21. }
Success #stdin #stdout 0s 2988KB
stdin
Standard input is empty
stdout
counting: 'état', 	got: 5
counting: 'ábécé', 	got: 8
counting: 'маля́р', 	got: 6
counting: 'יָּמִֽין', 	got: 8
counting: 'देव', 	got: 3
counting: 'द्ध्र्य', 	got: 7
counting: '世界', 	got: 2