Skip to content

why int.str() but rune.string() ? #23712

Closed Answered by JalonSolov
vodish asked this question in Questions and Answers
Discussion options

You must be logged in to vote

.string() (as documented), turns a rune array back into a string.

.str() is the default method of turning an array into a printable format - AS AN ARRAY.

Not specifying any method when printing an array is the same as calling the .str() method on the array - it is the default method.

That's exactly what is shown in your example.

The documentation could, perhaps, be made better, to make these distinctions more clear.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@JalonSolov
Comment options

Answer selected by JalonSolov
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants