You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue #3939 proposes removing the conversion from integer types to string types. In order to do that, it will be convenient if we have an exact replacement in the standard library.
I propose adding a new function to the unicode/utf8 package:
funcString(rrune) string
This function will return a string containing the UTF-8 encoding of its argument.
The implementation will be equivalent to the following, though of course it may be further optimized.
funcString(rrune) string {
vara [4]bytereturnstring(a[:EncodeRune(a[:], r)])
}
The text was updated successfully, but these errors were encountered:
SGTM although the name is cumbrous yet fits the package (but the As is new).
I think though you could get away with String: utf8.String(r) reads well. Although I admit it steals a good word, it's just a replacement for string(r) so why not?
ianlancetaylor
changed the title
proposal: unicode/utf8: add EncodeRuneAsString
proposal: unicode/utf8: add String
Mar 6, 2019
If we resolve #3939 by keeping string(r) for rune-typed r, then we won't need this.
If we do remove string(r), we will need to introduce this a release or two before string(r) disappears, to allow a smooth transition. Can put this on hold until #3939 plans are figured out.
Issue #3939 proposes removing the conversion from integer types to string types. In order to do that, it will be convenient if we have an exact replacement in the standard library.
I propose adding a new function to the unicode/utf8 package:
This function will return a string containing the UTF-8 encoding of its argument.
The implementation will be equivalent to the following, though of course it may be further optimized.
The text was updated successfully, but these errors were encountered: