Compare length of two strings: Difference between revisions
Content added Content deleted
m (spell correct) |
|||
Line 1,882: | Line 1,882: | ||
"fg" has length 2 and is the longest |
"fg" has length 2 and is the longest |
||
"e" has length 1 and is the shortest |
"e" has length 1 and is the shortest |
||
</pre> |
|||
=={{header|Transd}}== |
|||
<syntaxhighlight lang="Scheme">#lang transd |
|||
MainModule: { |
|||
v: ["abcd","123456789","abcdef","1234567"], |
|||
_start: (λ |
|||
(for s in (sort v (λ l String() r String() |
|||
(ret (< (size r) (size l))))) do |
|||
(lout width: 10 s " : " (size s) " code points") ) |
|||
) |
|||
}</syntaxhighlight> |
|||
{{out}} |
|||
<pre> |
|||
123456789 : 9 code points |
|||
1234567 : 7 code points |
|||
abcdef : 6 code points |
|||
abcd : 4 code points |
|||
</pre> |
</pre> |
||