Anonymous user
String matching: Difference between revisions
→{{header|Ruby}}
(Added Bracmat example) |
|||
Line 1,357:
=={{header|Ruby}}==
{{works with|Ruby|1.8.7}}
<lang ruby>p 'abcd'.start_with?('ab') #returns true
p 'abcd'.end_with?('
p 'abab'.include?('bb') #returns false
p 'abab'.include?('ab') #returns true
p 'abab'.index('bb') #returns
p 'abab'.index('ab') #returns 0
p 'abab'.index('ab', 1) #returns 2
p 'abab'.rindex('ab') #returns 2
</lang>
=={{header|Scala}}==
|