Please read blog.golang.org/strings.

-rob


On Sat, Oct 29, 2016 at 12:08 PM, <so.qu...@gmail.com> wrote:

> thanks! whats the "a:b" in this instance? did you mean s[i:i+1]? wouldn't
> that return a slice?
>
> so when iterating I'm comparing/using runes but what is the best way to
> refer to the ASCII values?
>
>
>
> On Saturday, October 29, 2016 at 9:36:57 AM UTC-7, Tamás Gulácsi wrote:
>>
>> 1. create the slice  (ss := make([]string, n)) and fill up (ss[i] =
>> s[a:b]), this will reuse the s's backing array, so use only the pointer to
>> the backing array and a length.
>> 2. rune is a unicode code point, an alias for int32. A string is an utf-8
>> encoded representation of a slice of runes: rr := []rune(s). `for _, r :=
>> range s` will range through the runes in the string. That utf-8 encoding
>> may use at most 4 bytes for a code point, but uses exactly 1 byte per ASCII
>> character.
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to