by Matt Terry (3 Submissions)
Category: String Manipulation
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Tue 10th October 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Converts string into legal file name
Dim I As Integer
Dim S As String
I = 1
Do While I <= Len(FileName)
S = Mid(FileName, I, 1)
If S = "\" Or S = "/" Or S = ":" Or S = "*" Or S = "?" Or S = "<" Or _
S = ">" Or S = "|" Or S = Chr(34) Then
If I > 1 Then
FileName = Left(FileName, I - 1) & Right(FileName, Len(FileName) - I)
Else
FileName = Right(FileName, Len(FileName) - 1)
End If
End If
I = I + 1
Loop
MakeIntoLegalFileName = FileName
End Function