string[i,0] gives you not the char but some kind of a marker just before that char.
So string[i,1]= ‘X’ overwrites that char, while
string[i,0] = ‘X’ inserts before it.
string[-1,1] gives you the last char of string, accordingly
string[-1,0] gives you that marker just before the last char.
You would have to do something like string[-0,0] to get behind the
last char if you want to count from the end of the string, which is not
possible so you have to count from the beginning: string[string.size,0]
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.