This commit is contained in:
Ingy döt Net 2013-10-27 22:24:23 +00:00
parent 6f050a029e
commit 776bba907c
3887 changed files with 59894 additions and 7280 deletions

View file

@ -10,7 +10,7 @@ x.length # ==> 3
# string comparison
if x == "hello"
puts equal
puts "equal"
else
puts "not equal"
end
@ -30,16 +30,18 @@ if x.empty?
end
# append a byte
x << "\07"
p x << "\07"
# substring
xx = x[0..-2]
p xx = x[0..-2]
x[1,2] = "XYZ"
p x
# replace bytes
y = "hello world".tr("l", "L")
p y = "hello world".tr("l", "L")
# join strings
a = "hel"
b = "lo w"
c = "orld"
d = a + b + c
p d = a + b + c