String indexing/setting

I think I found a version difference between 1.82 and 1.84-20 Stable and
I
wanted to know what correct code was and what was not.

pos = s.index(“11”)

s = “000011481^3”

s[2…pos] = “BigString”

puts s

On one server I have 1.82 and it generates “00BigString1481^3” on
another
with 1.84-20 it generates “00BigString”. However, on a third server I
have
a 1.84 version that puts out a similar version as the 1.82.

These are all Windows machines.

What should I be expecting?

Thanks!

Steven K. wrote:

I think I found a version difference between 1.82 and 1.84-20 Stable and I
wanted to know what correct code was and what was not.

pos = s.index(“11”)

what is ‘s’ here?

s = “000011481^3”

s[2…pos] = “BigString”

puts s

cheers

Simon

Sorry! Wrong order in the copy-and-paste.

s = “000011481^3”
pos = s.index(“11”)
s[2…pos] = “BigString”

puts s

Thanks!

Steve

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs