Re: [go-nuts] Amateur question: when you should use runes?

2021-11-18 Thread Jan Mercl
On Mon, Nov 15, 2021 at 7:00 PM Kamil Ziemian wrote: > ... when in practice you should use runes? For example the API of the unicode package uses runes extensively: https://pkg.go.dev/unicode. > My understanding at this moment is like that. Unicode assign every symbol a > number (at this momen

Re: [go-nuts] Amateur question: when you should use runes?

2021-11-18 Thread Brian Candler
The example given of using runes to split a string of digits into individual digits isn't a great one, because treating the string as an array of bytes would work just as well *in that situation* Where it matters is when you're processing a string with codepoints > 127, for example: "hellø wör

Re: [go-nuts] Amateur question: when you should use runes?

2021-11-17 Thread Kamil Ziemian
Thank you all for answers. I have a lot to do in next few weeks, after that I will go back to runes and think more about your answers. Best, Kamil poniedziałek, 15 listopada 2021 o 21:52:27 UTC+1 imsach...@gmail.com napisał(a): > On Tue, Nov 16, 2021 at 12:38 AM burak serdar wrote: > >> >> >>

Re: [go-nuts] Amateur question: when you should use runes?

2021-11-15 Thread Sachin Raut
On Tue, Nov 16, 2021 at 12:38 AM burak serdar wrote: > > > On Mon, Nov 15, 2021 at 11:00 AM Kamil Ziemian > wrote: > >> Hello, >> >> I read quite a few blog posts, articles, listen to nice number to talks >> about strings, runes and encoding in Go. I now reading Go Language Spec and >> I just st

Re: [go-nuts] Amateur question: when you should use runes?

2021-11-15 Thread burak serdar
On Mon, Nov 15, 2021 at 11:00 AM Kamil Ziemian wrote: > Hello, > > I read quite a few blog posts, articles, listen to nice number to talks > about strings, runes and encoding in Go. I now reading Go Language Spec and > I just stuck in the section about runes. I mean, it isn't hard as itself, > bu

Re: [go-nuts] Amateur question: when you should use runes?

2021-11-15 Thread Robert Engels
When your string contains Unicode characters dealing with it as individual bytes is difficult. When using runes with range - each index is a “Unicode character” (which may be multiple bytes) - which is easy to use. See go.dev/blog/strings > On Nov 15, 2021, at 12:00 PM, Kamil Ziemian wrote:

[go-nuts] Amateur question: when you should use runes?

2021-11-15 Thread Kamil Ziemian
Hello, I read quite a few blog posts, articles, listen to nice number to talks about strings, runes and encoding in Go. I now reading Go Language Spec and I just stuck in the section about runes. I mean, it isn't hard as itself, but it raises to much questions to me. I decided that I need to le