Created
January 17, 2017 04:05
-
-
Save samcv/3661ba40798e613b5e1d96756ee1767f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use nqp; | |
my str $string = "this,that,other,thing," x 100; | |
my int $chars = nqp::chars($string); | |
my $i := nqp::add_i(0,0); | |
$i := nqp::add_i(0, 50); | |
nqp::while(nqp::isle_i($i, $chars), ( | |
$string = nqp::replace($string, nqp::index($string, ',', $i), 1, ",\n"); | |
$i := nqp::add_i($i, 50); | |
) | |
); | |
say $string; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment