Just another Perl shrine | |
PerlMonks |
Re: truncate string to byte countby harangzsolt33 (Chaplain) |
on Feb 28, 2019 at 01:42 UTC ( [id://1230646]=note: print w/replies, xml ) | Need Help?? |
Well, every Utf8-encoded character takes up 16 bits, so you just simply divide by 2 and make sure the result is an even number. If it is not, then subtract one, and then you have an index where it is safe to split the string. I don't understand why is this such a huge problem?
In Section
Seekers of Perl Wisdom
|
|