/top/
/new/
/best/
/ask/
/show/
/job/
^
slacker news
login
about
←back to thread
Go subtleties
(harrisoncramer.me)
235 points
darccio
| 1 comments |
13 Oct 25 07:42 UTC
|
HN request time: 0.357s
|
source
Show context
johnmaguire
◴[
22 Oct 25 16:14 UTC
]
No.
45671374
[source]
▶
>>45565793 (OP)
#
> Using len() with Strings, and UTF-8 Gotchas
Try utf8.RuneCountInString().
replies(1):
>>45672551
#
1.
gethly
◴[
22 Oct 25 17:41 UTC
]
No.
45672551
[source]
▶
>>45671374
#
Problem with this is that it requires the whole string to be iterated over, byte by byte, or rune by rune, whereas len() does no such thing as the length is stored in the underlying type.
ID:
GO
↑