ckReplace (now with invalid char stripping)
For use with MS Access databases mostly. - this function allows you to with strip characters from a string, replace characters in a string with other characters or strip/replace all non-alpha characters (not printable) from the string.
AI
AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Source Code
Function ckReplace(StrIN As String, Optional StripChar As String = "", Optional ReplaceChar As String = "") As String
Dim x As Integer
x = 1
If StripChar <> "" Then
Do Until x <= 0 Or StripChar = ReplaceChar
x = InStr(1, StrIN, StripChar)
If x > 0 Then StrIN = left$(StrIN, x - 1) & ReplaceChar & Right$(StrIN, Len(StrIN) - (x - 1) - Len(StripChar))
Loop
Else
For x = 1 To Len(StrIN)
If x > Len(StrIN) Then Exit For
If Asc(Mid$(StrIN, x, 1)) < 32 Or Asc(Mid$(StrIN, x, 1)) > 126 Then
StrIN = left$(StrIN, x - 1) & ReplaceChar & Right$(StrIN, Len(StrIN) - (x - 1) - 1)
If ReplaceChar = "" Then x = x - 1
End If
Next
End If
ckReplace = StrIN
End Function
Original Comments (3)
Recovered from Wayback Machine