to sequence, sort, and join sequence.
- using toSeq
import sequtils
import algorithm
import strutils
let value = "54321"
let sortedChars = toSeq(value.items).sorted(cmp)
echo sortedChars.join() #12345
- using @
import algorithm
import strutils
let value = "54321"
let sortedChars = @value.sorted(cmp)
echo sortedChars.join() #12345
Top comments (2)
It's very short. So nice!