Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27355

For Loop Debug

$
0
0
I was making an invalid character removal module for my program, and here is the function that I used:
Code:

Function fix_extensions(file_extension As String)
        'Fixes file extensions
        Dim banned_ext_chars() As String = {"\", "/", ":", ";", "*", "?", """", "<", ">", "|", "%", ",", "#", "$", "!", "+", "{", "}", "&", "[", "]", "•", "'", "."}
        For index As Integer = 1 To banned_ext_chars.Length - 1
            file_extension = file_extension.Replace(banned_ext_chars(index), "")
        Next
        file_extension = "." & file_extension
        Return file_extension
    End Function

However, upon checking the output through a short debug, it appears that the backslash was never filtered out. I've tried many things, but none worked.

Help would be greatly appreciated.

Viewing all articles
Browse latest Browse all 27355

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>