Geeks With Blogs
Jon Egerton Tips tricks and general musings

I was looking for a method to easily find the last instance of a search string within a longer string.

I found a few instances of ways to do this that involve functions that loop through until no-more instances of the search string are found and some mention of using the SQL-Server 2005+ Reverse function for single character searches.

What wasn't mentioned is that the method of using the Reverse function can be extended/generalized to search for SubStrings of varying lengths.

See my article for more:

Posted on Monday, July 25, 2011 5:17 AM | Back to top

Comments on this post: Finding the last instance of a string using Replace - the generalized way!

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Jon Egerton | Powered by: | Join free