Skip to content

Instantly share code, notes, and snippets.

@wicky-andrian
Created April 23, 2020 16:00
Show Gist options
  • Save wicky-andrian/a226bbf2411e207598649f4d781b9eec to your computer and use it in GitHub Desktop.
Save wicky-andrian/a226bbf2411e207598649f4d781b9eec to your computer and use it in GitHub Desktop.
Contoh metode string part 6
a = "Java Ruby Java Ruby"
puts a
puts "Objek ID: #{a.object_id}"
b = a.sub("Java", "Python")
puts b
puts "Objek ID: #{b.object_id}"
c = a.sub!("Ruby","Kotlin")
puts c
puts "Objek ID: #{c.object_id}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment