String matching: Difference between revisions

(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?('znab') #returns false
p 'abab'.include?('bb') #returns false
p 'abab'.include?('ab') #returns true
p 'abab'.index('bb') #returns -1nil
p 'abab'.index('ab') #returns 0
p 'abab'.index('ab', 1) #returns 2</lang>
p 'abab'.rindex('ab') #returns 2
</lang>
 
=={{header|Scala}}==
Anonymous user