I don't know what can be wrong...
What about following code?
... use utf8; my $max_text_len = 40; ... sub split_text { my $intext = shift || return ''; my @result = (); my $index = 0; foreach my $word (split(' ', $intext)) { next if !length($word); if (length("$result[$index] $word") > $max_text_len) { $index++; $result[$index] = $word; } else { $result[$index] .= ($result[$index] ? ' ' : '').$word; } } return join("\n", @result); }
In reply to Re: Unicode word wrapping
by ph0enix
in thread Unicode word wrapping
by lestrrat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |