Thread String manipulation (30 answers)
Opened by Haselnuss992 at 2018-10-15 15:39

Muffi
 2018-10-15 15:49
#188959 #188959
User since
2012-07-18
1465 Artikel
BenutzerIn
[default_avatar]
Na so schlimm ist es wieder auch nicht.

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
my $string = 'abcijuwegwegwglwjgwgwhgwkgjnwgkjwngwnmgioghwoöighwghwgökwnglkwhgwohgwelökgnwgklweghgweghwelg,wngwehgwhgweoöhgwegnjwegnwegmwgega';

sub MAXSIZE { 13 };

my @parts = ();
my $cur = 0;

while ($cur < length($string)) {
        push @parts, substr($string, $cur, MAXSIZE);
        $cur += MAXSIZE;
}

say "@parts";
1 + 1 = 10

View full thread String manipulation