Skip to content

Instantly share code, notes, and snippets.

@asynxc
Created September 28, 2016 21:02
Show Gist options
  • Save asynxc/9fb56a9a953401ffecc3a240d9768497 to your computer and use it in GitHub Desktop.
Save asynxc/9fb56a9a953401ffecc3a240d9768497 to your computer and use it in GitHub Desktop.
'Replace() Alternative function
'Coded By hamavb
'MSVBVM60.rtcReplace
Public Declare Function rtcReplace Lib "MSVBVM60" (ByVal expression As String, ByVal Find As String, ByVal Replace As String, ByVal Start As Long, ByVal Count As Long, ByVal CompareMthd As Long) As String
Public Function Alternative_Replace(ByVal expression As String, ByVal Find As String, ByVal Replace As String, Optional ByVal Start As Long = 1, Optional ByVal Count As Long = -1, Optional ByVal CompareMthd As VbCompareMethod = vbBinaryCompare) As String
Alternative_Replace = StrConv(rtcReplace(StrConv(expression, vbUnicode), StrConv(Find, vbUnicode), StrConv(Replace, vbUnicode), Start, Count, CompareMthd), vbFromUnicode)
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment