Created
April 23, 2020 15:49
-
-
Save wicky-andrian/3eeb4e3e85f74e25c7313afbba33f8ae to your computer and use it in GitHub Desktop.
Contoh metode string part 6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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