RosettaCodeData/Task/String-length/Retro/string-length-2.retro

16 lines
261 B
Plaintext

chain: UTF8'
{{
: utf+ ( $-$ )
[ 1+ dup @ %11000000 and %10000000 = ] while ;
: count ( $-$ )
0 !here
repeat dup @ 0; drop utf+ here ++ again ;
---reveal---
: getLength ( $-n )
count drop @here ;
}}
;chain
"møøse" ^UTF8'getLength putn