' FB 1.05.0 Win64 Function stripControlChars(s As Const String) As String If s = "" Then Return "" Dim count As Integer = 0 Dim strip(0 To Len(s) - 1) As Boolean For i As Integer = 0 To Len(s) - 1 For j As Integer = 0 To 31 If s[i] = j OrElse s[i] = 127 Then count += 1 strip(i) = True Exit For End If Next j Next i Dim buffer As String = Space(Len(s) - count) count = 0 For i As Integer = 0 To Len(s) - 1 If Not Strip(i) Then buffer[count] = s[i] count += 1 End If Next Return buffer End Function Function stripExtendedChars(s As Const String) As String If s = "" Then Return "" Dim count As Integer = 0 Dim strip(0 To Len(s) - 1) As Boolean For i As Integer = 0 To Len(s) - 1 For j As Integer = 128 To 255 If s[i] = j Then count += 1 strip(i) = True Exit For End If Next j Next i Dim buffer As String = Space(Len(s) - count) count = 0 For i As Integer = 0 To Len(s) - 1 If Not Strip(i) Then buffer[count] = s[i] count += 1 End If Next Return buffer End Function Dim s As String = !"\v\001The\t quick\255 \vbrown\127\f fox\156" Dim s1 As String = stripControlChars(s) Dim s2 As String = stripExtendedChars(s) Dim s3 As String = stripExtendedChars(s1) ' Under Windows console, code page 850 : ' "vertical tab" displays as ♂ ' "form feed" displays as ♀ ' Chr(1) displays as ☺ ' Chr(127) displays as ⌂ ' the other control characters do what it says on the tin ' Chr(156) displays as £ ' Chr(255) displays as space Print "Before stripping :" , s Print "Ctl chars stripped :" , s1 Print "Ext chars stripped :" , s2 Print "Both sets stripped :" , s3 Print Print "Before stripping" , "Length => " ; Len(s) Print "Ctl chars stripped" , "Length => " ; Len(s1) Print "Ext chars stripped" , "Length => " ; Len(s2) Print "Both sets stripped" , "Length => " ; Len(s3) Print Print "Press any key to quit" Sleep