String bug in ruby


String wrong behaviour

Given Data

s1 = “This is first string”

s2 = s1

True Case
if you do

s2 = “2nd string”

and then check the value of s1, it will be same which we set first time in it.

False Case
if you do

s2[14..19]=’change’

and then check the value of s1,
it will be
“This is first change”

which is not required behaviour

Advertisements

I am Senior Software Engineer. I love reading, writing, sharing,developing, hiking, movies, trips, mountains, brooks, hills etc.

Posted in bug

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

StackOverFlow
Categories
Archives
%d bloggers like this: