3 ms·
In a sentence, Ruby 1.8 Strings are just a set of bytes, so methods like length count the number of bytes, Ruby 1.9 Strings are a set of characters, so length c
by jamiecobbett 16y ago
In a sentence, Ruby 1.8 Strings are just a set of bytes, so methods like length count the number of bytes, Ruby 1.9 Strings are a set of characters, so length counts characters. This makes a difference when you have multi-byte characters, and want an accurate length, a correct split, reverse etc.
I found this series of articles well worth the time to read and understand:
http://blog.grayproductions.net/articles/understanding_m17n http://blog.grayproductions.net/articles/understanding_m17n