Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ranging over string of int gives wrong output #40325

Closed
gandharvas opened this issue Jul 21, 2020 · 2 comments
Closed

Ranging over string of int gives wrong output #40325

gandharvas opened this issue Jul 21, 2020 · 2 comments

Comments

@gandharvas
Copy link

What version of Go are you using (go version)?

$ go version
go1.14.6

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
Windows

What did you do?

https://play.golang.org/p/1RVQkIi61nI

What did you expect to see?

1 2 3 4

What did you see instead?

49 50 51 52

@gandharvas
Copy link
Author

Can I work on this issue and fix?

@ianlancetaylor
Copy link
Contributor

This is correct behavior. The string is Unicode, and the Unicode value for 1 is decimal 49 (https://www.codetable.net/decimal/49).

Compare to https://play.golang.org/p/vOaWa9sdw0e.

Closing because this is not a bug.

@golang golang locked and limited conversation to collaborators Jul 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants