-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
Let collections.Reverse
work on strings
#12839
Comments
If I were looking in our documentation for a template function that reverses a string, I would look for something in the strings namespace. The string "Hello 👋🏿" will be difficult to properly reverse. |
Well, it's not ... impossible. My question is how useful it is. I have not read the discussion linked above; what is the use case and is it a common use case? |
This is the first request I've seen. |
It was a solution (or better: workaround) for a different problem. I would say it's quite unusual and of limited use to the public. But speaking in general, it was quite surprising to me, that there isn't such a function. |
Closing for now. Uncommon use case and non-trivial implementation. |
It is currently hard to reverse a string. This forum thread discuses some workarounds but the best would be to let
collections.Reverse
do the job.As @jmooring mentioned in the thread, this could probably lead to invalid unicode strings in case of non-ascii characters (this depends on how strings are represented in go and which set of functions will be used to reverse the string - I am not experienced in go).
So as a limitation it may only result in a reversed binary buffer instead of a usable reversed string.
The text was updated successfully, but these errors were encountered: