Hey,

Is there a way, by using find, to create a method that finds the last occurrence of a character in a string?

I know how to use the find method to find the first occurrence but have no idea how to do it backwards.

Basically this is what I want to do:

#Say I have the following string:

stringA = 'abcded'

#I want to be able to print out the position of the last 'd',
#which should be 5 instead of 3 (the position of the first 'd'
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.