This commit is contained in:
Ingy döt Net 2013-06-05 21:47:54 +00:00
parent 1f1ad49427
commit 6f050a029e
2496 changed files with 37609 additions and 3031 deletions

View file

@ -1,9 +1,10 @@
str = 'abcdefgh'
n = 2
m = 3
puts str[n, m]
puts str[n..-1]
puts str[0..-2]
puts str[str.index('d'), m]
puts str[str.index('de'), m]
puts str[/a.*d/]
puts str[n, m] #=> cde
puts str[n..m] #=> cd
puts str[n..-1] #=> cdefgh
puts str[0..-2] #=> abcdefg
puts str[str.index('d'), m] #=> def
puts str[str.index('de'), m] #=> def
puts str[/a.*d/] #=> abcd