The string contains 6 bytes which encode 5 characters : unicode « String « Ruby






The string contains 6 bytes which encode 5 characters


s = "2×2=4"


s.length        # => 5: Characters:  '2'   '×'   '2'   '='   '4'
s.bytesize      # => 6: Bytes (hex): 32   c3 97  32    3d    34

 








Related examples in the same category

1.Unicode string
2.leading zeros cannot be dropped
3.Greek lowercase pi
4.a string literal containing a multibyte multiplication character