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

.sort on Str does not sort #4843

Closed
p6rt opened this issue Dec 9, 2015 · 4 comments
Closed

.sort on Str does not sort #4843

p6rt opened this issue Dec 9, 2015 · 4 comments

Comments

@p6rt
Copy link

p6rt commented Dec 9, 2015

Migrated from rt.perl.org#126860 (status was 'rejected')

Searchable as RT126860$

@p6rt
Copy link
Author

p6rt commented Dec 9, 2015

From @gfldex

"bca".sort.say
# OUTPUT«(bca)␤»

@p6rt
Copy link
Author

p6rt commented Dec 9, 2015

From @coke

This is behaving as intended.

.sort works on something list-like (FYI, this method is coming in via the Any class).

A Str is a single item, so the result of calling sort on it is a list containing the original string as the only element.

If you want to sort the individual characters, you can use​:

"NOTABUG".comb.sort.join # no-arg comb returns a list of the individual characters, then we sort the list, and then join it back together
ABGNOTU

Regards.

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Dec 9, 2015

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Dec 9, 2015

@coke - Status changed from 'open' to 'rejected'

@p6rt p6rt closed this as completed Dec 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant