Runes versus strings

strings seem to be made of uint8 characters. runes seem to be larger. Does this mean there are two sets of functions for dealing with these two kinds of data? In particular I am looking for isdigit. There seems to be one that works on runes, but not one that works on ASCII.

strings seem to be made of uint8 characters.

strings are immutable []byte slices.

runes seem to be larger.

yes, the size of a rune is larger than a byte.

Does this mean there are two sets of functions for dealing with these two kinds of data?

Yes

In particular I am looking for isdigit. There seems to be one that works on runes, but not one that works on ASCII.

If you have a value as a byte, you may need to convert it to a rune, http://play.golang.org/p/3bnfO4-ChW

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.