How to replace only the LAST occurrence of a substring.
Posted on January 4, 2009
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 |
Related posts:
- How to count the number of occurrences of a substring inside another string
- How to check if a given string starts with a given substring
- How to check if a given string ends with a given substring
- How to find a string between two substring on a given string phrase
- How to Replace a string on first line of a text box.
- How to use Replace function for VB5
- How to replace a character in middle of the string
- How to Replace Multiple Substrings in a String at Once
- Replacement for VB6’s Replace$ function (fastest way)
- How to do Replace All in Visual Basic