method

[]=

Importance_1
v3.0.9 - Show latest stable - 0 notes - Class: ActiveSupport::Multibyte::Chars
[]=(*args) public

Like String#[]=, except instead of byte offsets you specify character offsets.

Example:

s = "Müller"
s.mb_chars[2] = "e" # Replace character with offset 2
s
# => "Müeler"

s = "Müller"
s.mb_chars[1, 2] = "ö" # Replace 2 characters at character offset 1
s
# => "Möler"
Show source
Register or log in to add new notes.