Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Test on a substring character doesn't seem to be working

$
0
0

I'm trying to check the last character of a string to see if it is a "\", if not I want to append a backslash to the string.  However, it is adding a backslash even if the character is already a backslash. So I end up with "\\" at the end of the sting.   I displayed the character that is being checked and it displays a backslash.  Here is my code:

        MessageBox.Show(dbPath.Substring(dbPath.Length - 1, 1))        'this line displays: \

        If (dbPath.Substring(dbPath.Length - 1, 1) IsNot "\") Then
            dbPath = dbPath & "\"                                                               'this line should not execute in this case, but it does
        End If

<object id="kpm_plugin" type="application/x-KPMPlugin"></object>

<object id="kpm_plugin" type="application/x-KPMPlugin"></object>

Viewing all articles
Browse latest Browse all 18858

Trending Articles



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