sort a string

Chris Katko ckatko at gmail.com
Fri May 1 07:38:53 UTC 2020


I'm making anagrams. According to the nextPermutation() docs, I 
need to 'sort by less' to get all permutations. ... Except the 
doc page doesn't mention how to do that, nor does 
std.algorithm.sort show how to sort a string. ... and the google 
results on the dlang forums from 2017 don't work.

I've tried .byCodeUnit. , .representation. I've tried sorting on 
the dchar. I've tried sorting the on string.

The closest I've gotten:

	string word = "bar";
	string line2 = toLower!(string)(word);
    	dchar[] line3 = sort(line2.to!(dchar[]));

"Error: cannot implicitly convert expression sort(to(line2)) of 
type SortedRange!(dchar[], "a < b") to dchar[]"



More information about the Digitalmars-d-learn mailing list