4
4
4utka_pyan2017-07-05 16:58:21
go
4utka_pyan, 2017-07-05 16:58:21

How to determine if a string contains unicode?

This is necessary in order to calculate the length of the string.
Or it makes sense to connect in any case and just do this option, the answer gives the correct one, regardless of what characters are inside. import "unicode/utf8"fmt.Println(utf8.RuneCountInString("жжvv"))

Answer the question

In order to leave comments, you need to log in

1 answer(s)
U
uvelichitel, 2017-07-05
@4utka_pyan

Yes. Well, you can stillutf8.RuneCountInString("жжvv")

runes:=0
for range "жжvv"{
    runes++
}
fmt.Println(runes)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question