-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add line sorting to string utils #835
Conversation
src/dev/impl/DevToys/ViewModels/Tools/Text/StringUtilities/StringUtilitiesToolViewModel.cs
Outdated
Show resolved
Hide resolved
src/dev/impl/DevToys/ViewModels/Tools/Text/StringUtilities/StringUtilitiesToolViewModel.cs
Show resolved
Hide resolved
|
||
viewModel.RandomizeCommand.Execute(null); | ||
|
||
// Can't guarantee the order, just make sure everything is still there |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An interface could be introduced, then we could mock and guarantee results, something like https://stackoverflow.com/a/311829/17052649 if that's acceptable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a bad idea. I hadn't dived into how DI is set up, so I wasn't sure if I could inject the real Random
though the constructor. Also thought it might be a bit overkill. I guess I'll leave this one up to the maintainer.
src/dev/impl/DevToys/ViewModels/Tools/Text/StringUtilities/StringUtilitiesToolViewModel.cs
Outdated
Show resolved
Hide resolved
src/dev/impl/DevToys/ViewModels/Tools/Text/StringUtilities/StringUtilitiesToolViewModel.cs
Outdated
Show resolved
Hide resolved
src/dev/impl/DevToys/ViewModels/Tools/Text/StringUtilities/StringUtilitiesToolViewModel.cs
Show resolved
Hide resolved
src/dev/impl/DevToys/ViewModels/Tools/Text/StringUtilities/StringUtilitiesToolViewModel.cs
Outdated
Show resolved
Hide resolved
src/dev/impl/DevToys/ViewModels/Tools/Text/StringUtilities/StringUtilitiesToolViewModel.cs
Show resolved
Hide resolved
src/dev/impl/DevToys/ViewModels/Tools/Text/StringUtilities/StringUtilitiesToolViewModel.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved. Thank you again for this improvement!
Pull request type
Please check the type of change your PR introduces:
What is the current behavior?
Issue Number: #232
What is the new behavior?
Add the following functions to the string utilities tool. These operate on lines of text.
DevToys-Alphabetize-Demo.mp4
Other information
All of the line splitting is done on CR (
\r
). I noticed that this is the line separator used for typed text and loaded files using any line endings (CR, LF,"or or CRLF). I don't really understand why, but it seems consistent.For sorting by last word, I'm splitting on space and also comma (to accommodate CSV and last,first formatting).
It might be ever so slightly confusing that the "Original text" button is under the "Convert" heading. Maybe we could consider making it a highlighted/action button.
Quality check
Before creating this PR: