Sort the letters of string in alphabetical order: Difference between revisions
Content added Content deleted
m (→case insensitive: string) |
|||
Line 84: | Line 84: | ||
<lang fsharp> |
<lang fsharp> |
||
// Alphabetic sort. Nigel Galloway: July 27th., 2021 |
// Alphabetic sort. Nigel Galloway: July 27th., 2021 |
||
⚫ | |||
let fG n g=let g=g|>Seq.countBy id|>Map.ofSeq in [for n in n->if Map.containsKey n g then [|for g in 1..g.[n]->n|]|>System.String else ""]|>String.concat "" |
let fG n g=let g=g|>Seq.countBy id|>Map.ofSeq in [for n in n->if Map.containsKey n g then [|for g in 1..g.[n]->n|]|>System.String else ""]|>String.concat "" |
||
⚫ | |||
printfn "%s" ( |
printfn "%s" (English "baNAnaBAnaNA") |
||
</lang> |
</lang> |
||
{{out}} |
{{out}} |
||
Line 92: | Line 92: | ||
aaaAAAbBnnNN |
aaaAAAbBnnNN |
||
</pre> |
</pre> |
||
=={{header|Go}}== |
=={{header|Go}}== |
||
As in the case of the Wren entry, we write a function to bubble sort the characters of a string since this method is not, of course, used in Go's standard 'sort' package. |
As in the case of the Wren entry, we write a function to bubble sort the characters of a string since this method is not, of course, used in Go's standard 'sort' package. |