Sort the letters of string in alphabetical order: Difference between revisions

Content added Content deleted
(Add Comal)
Line 1,055: Line 1,055:
.Pabcdeefghiiijklmnoooqrstuuvwxyz
.Pabcdeefghiiijklmnoooqrstuuvwxyz
</pre>
</pre>


=={{header|Yabasic}}==
<lang Yabasic>// Rosetta Code problem: http://rosettacode.org/wiki/Sort_the_letters_of_string_in_alphabetical_order
// by Galileo, 04/2022

sub Sorted$(t$)
local chars(255), c, i, j, r$
for i = 1 to len(t$)
c = asc(mid$(t$, i, 1))
chars(c) = chars(c) + 1
next
for i = 1 to 255
c = chars(i)
if c then
for j = 1 to c
r$ = r$ + chr$(i)
next
end if
next
return r$
end sub


text$ = "Sort the letters of string in alphabitical order."

print text$
print Sorted$(text$)</lang>
{{out}}
<pre>Sort the letters of string in alphabitical order.
.Saaabcdeeeefghhiiiilllnnoooprrrrrsstttttt
---Program done, press RETURN---</pre>