On 2015-06-02 05:45, Skybuck Flying wrote:
Example for python:

MyString = "Hello World"

print MyString.rfind("World")
if MyString.rfind("World"):
print "yes"
else:
print "no"

Pretty cool.

.rfind returns the index if found, -1 if not found.

"World".rfind("World") returns 0, which will be treated as false.

"foo".rfind("World") returns -1, which will be treated as true.

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to