I have a utf8 string that I need to truncate, but I want to obviously make sure it is truncated at a character boundary.
s.slice does not ensure that.
Is there a clean fast way to do that?
I have a utf8 string that I need to truncate, but I want to obviously make sure it is truncated at a character boundary.
s.slice does not ensure that.
Is there a clean fast way to do that?
s.mb_chars.slice
Please ask questions like these on the rubyonrails-talk list the next
time, this list is for development of the framework itself.
Cheers, Eloy
Understood. Solved anyway - s.mb_chars.slice(..)