#Cursed code-formatter
1 messages · Page 2 of 1
Sorting a string alphabetically can provide insights into the statistical usage of characters, perhaps
lets you compare how many times "z" appears in a language compared to "y"
for example
though there's better ways to do that
by... y'know... counting the characters
If I wanted to do that, I'd just have it output the number of each character kekw
indeed. Still, makes the sorter not 100% useless
just like 99%
Possibly it could be somewhat useful for font analysys. though I fail to see a specific use case
Yea
but it'd make me cEhir and I gotta say, that's a pretty cool name
i'd turn you into aefglstu
OH actually I do have a pseudo-practical application @restive crown - I did at some point write one of those sorters in order to test a GUI. So I suppose it can be useful for testing purposes.
...then again, most things can be useful for testing purposes.
Yep
I've actually turned it into a command line application
With flags and everything
I think the next feature I should add is a -f -o to read from a file and output it to a file
another flag to sort the file's name alphabetically too
That one's probably difficult
Wait
-c to make it a copy, without -c it sorts the text in place
I think I can create a new file with the sorted name, then delete the old file?
should be absolutely doable
I can name this the most advanced string sorter kekw
now all you need is a string sorter to actually sort the name of the file. I wonder if anyone's written something like that
we'd have a great use case for it here
That one might be complicated
Because __FILE__ only works for the file you write it in
i.e. it only works for src.cc
you could of course also just sort the name of the file's copy, assuming the c flag is given
this would also mean that you don't have to attach some arbitrary file extension to avoid name conflict with the source file
Instead, I think I could simply sort the entire file name, including the extension
Unless the file is in alphabetical order already, e.g. .git, it'll probably not conflict
but .git is a folder, so
Now I'm wondering whether it would be possible to sort an entire folder
I wonder how that's manifest. Sort all the characters into one file? sort each file but leave the files themselves be?
It'd most likely be the same as sorting all the files in the folder individually