Home > How-To Library > String Manipulation

How to replace only the LAST occurrence of a substring.

**************************************************************** * © 2007 CodeItBetter http://www.codeitbetter.com * * This notice MUST stay intact for legal use * ****************************************************************
Function ReplaceLast(Source As String, Search As String, ReplaceStr As String) As String ReplaceLast = StrReverse(Replace(StrReverse(Source), StrReverse(Search), _ StrReverse(ReplaceStr), , 1)) End Function

If you would like to submit your code here please us. Do not forget to mention your name. We are always thankful to each and everyone of you who submitted their code here.