Skip to content

Instantly share code, notes, and snippets.

@wicky-andrian
Created April 23, 2020 15:49
Show Gist options
  • Save wicky-andrian/3eeb4e3e85f74e25c7313afbba33f8ae to your computer and use it in GitHub Desktop.
Save wicky-andrian/3eeb4e3e85f74e25c7313afbba33f8ae to your computer and use it in GitHub Desktop.
Contoh metode string part 6
a = " Ruby "
puts a
puts "Objek ID: #{a.object_id}"
puts a.length
b = a.strip
puts b
puts "Objek ID: #{b.object_id}"
puts b.length
c = a.strip!
puts c
puts "Objek ID: #{c.object_id}"
puts c.length
#output
Ruby
Objek ID: 60
8
Ruby
Objek ID: 80
4
Ruby
Objek ID: 60
4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment