I need to write a function "Elimination" which has arguments S as string K1, K2 characters. The function needs to return a string which is obtained when you remove characters K1 and K2.
So if I forward to function ("Odgovornost","o",s") it returns "Odgvrnt".
I tried:
Function Eliminacija(S As String, K1 As String, K2 As String)
Dim I As Integer
For I = 1 To Len(S)
If Mid(S, I, 1) Like "K1" Or Mid(S, I, 1) Like "K2" Then
Mid(S, I, 1) = ""
End If
Next
Elimination = S
mid()to"", and you cannot refer to a variable by providing its name as a string literal. Simply callReplace()twice onS. If you want to usemid()anyway, declare a buffer of original length ofS, loop overSand only copy the current character into the buffer (withmid() =) if it does not equalK1orK2.Replace(Replace(S, K1, ""), K2, "").