sort a string
drug
drug2004 at bk.ru
Fri May 1 15:17:53 UTC 2020
01.05.2020 18:04, notna пишет:
>
> hmmm, whích results in:
> Error: cannot use [] operator on expression of type dchar
>
try this:
```D
import std;
void main()
{
string word = "Привет";
dchar[] line3 = to!(dchar[])(word.dup) // make a copy to get a
range of mutable char
// and convert char to dchar
.sort // sort it
.release; // get the sorted range
assert(line3 == "Пвеирт");
}
```
More information about the Digitalmars-d-learn
mailing list