CodeItBetter Programming Another VB Programming Blog

How to replace only the LAST occurrence of a substring.

Posted on August 18, 2011
1
2
3
4
5
'String Manipulation - How to replace only the LAST occurrence of a substring.
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
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.