Is there a cleaner way to write the 

s:= *t
*t = s[i+1:]

part?

was hoping for something like *t = *t[i+1:]


type Token []byte

func (t *Token) Next() bool {
if i := bytes.IndexByte(*t, '.'); i > -1 {
s := *t
*t = s[i+1:]
return true
}
return false
}

func (t Token) String() string {
if i := bytes.IndexByte(t, '.'); i > -1 {
return string(t[:i])
}
return string(t)
}

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/5f59f852-99e5-472f-9857-cac893907ad6%40googlegroups.com.

Reply via email to