in reply to truncate string to byte count
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?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: truncate string to byte count
by Your Mother (Archbishop) on Feb 28, 2019 at 01:55 UTC | |
Re^2: truncate string to byte count
by LanX (Saint) on Feb 28, 2019 at 11:50 UTC | |
Re^2: truncate string to byte count
by ikegami (Patriarch) on Feb 28, 2019 at 20:18 UTC |
In Section
Seekers of Perl Wisdom