On 2/6/19 12:17 PM, yary wrote:
On Wed, Feb 6, 2019, 11:57 AM ToddAndMargo via perl6-users
<perl6-users@perl.org <mailto:perl6-users@perl.org>> said
What would be the most practice way of converting a string to and
array of characters
Brad said-
You should be using `comb` if you want a list of characters not `split`.
# these are all identical
'abcd'.comb.kv
'abcd'.comb(1).kv
comb( 1, 'abcd' ).kv
And you read through my typos too!
$ p6 'my Str $x="abcd"; for $x.comb.kv -> $i, $j {say "Index <$i> = <$j>
= ord <" ~ ord($j) ~ ">";}'
Index <0> = <a> = ord <97>
Index <1> = <b> = ord <98>
Index <2> = <c> = ord <99>
Index <3> = <d> = ord <100>