Skip to content

Instantly share code, notes, and snippets.

@hynkle
Created August 26, 2011 18:08
Show Gist options
  • Select an option

  • Save hynkle/1174010 to your computer and use it in GitHub Desktop.

Select an option

Save hynkle/1174010 to your computer and use it in GitHub Desktop.
string range replacement
s = "Hello world!"
# => "Hello world!"
s[6..-2] = "pukeface"
# => "pukeface"
s
# => "Hello pukeface!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment