RosettaCodeData/Task/String-length/SPL/string-length.spl

25 lines
449 B
Text
Raw Permalink Normal View History

2017-09-23 10:01:46 +02:00
t = ["abc","J̲o̲s̲é̲","møøse","𝔘𝔫𝔦𝔠𝔬𝔡𝔢"]
> i, 1..#.size(t,1)
? i>1, #.output()
#.output(#.quot,t[i],#.quot," contains")
p = #.split(t[i])
cn = #.size(p,1)
s = #.str(cn,">3>")+" chars: "
> j, 1..cn
? j>1, s += ", "
s += p[j]
<
#.output(s)
q = #.array(t[i])
bn = #.size(q,1)
s = #.str(bn,">3>")+" bytes: "
> j, 1..bn
? j>1, s += ", "
s += #.str(q[j],"X2")+"h"
<
#.output(s)
<