VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Converts string into legal file name

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

Rate 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

Download this snippet    Add to My Saved Code

Converts string into legal file name Comments

No comments have been posted about Converts string into legal file name. Why not be the first to post a comment about Converts string into legal file name.

Post your comment

Subject:
Message:
0/1000 characters