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

String comparison with hyphen

$
0
0
I am using visual basic 2010 express and i need to compare two strings to check if they are the same. The string is "V6EPB-B-S-3-B-CSA". If i put a watch on the variables that hold the string i can see they are the same, but my if clause:

If String.Compare(currentCol(0), modelNumber, StringComparison.OrdinalIgnoreCase) > 0 Then

Still returns a -1 value.

I already tried changing the last argument to StringComparison.CurrentCulture and StringComparison.InvariantCulture and still does not work as per this: http://msdn.microsoft.com/en-us/library/e6883c06.aspx
I am assuming the comparison does not result a positive value because of the hyphen in the middle of the string. How can i make this work?

Thanks

Viewing all articles
Browse latest Browse all 27199

Trending Articles



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