Compare length of two strings: Difference between revisions

(Added Algol 68)
Line 33:
"short" has length: 5 bytes.
</pre>
 
=={{header|jq}}==
{{works with|jq}}
'''Works with gojq, the Go implementation of jq'''
<lang jq>
def s1: "longer";
def s2: "shorter😀";
 
[s1,s2]
| sort_by(length)
| reverse[]
| "\"\(.)\" has length (codepoints) \(length) and utf8 byte length \(utf8bytelength)."
 
</lang>
{{out}}
<pre>
"shorter😀" has length (codepoints) 8 and utf8 byte length 11.
"longer" has length (codepoints) 6 and utf8 byte length 6.
</pre>
 
 
=={{header|Julia}}==
2,497

edits