How do I make an OR Statement.
Im trying to do this
Code:name3 = [name2].EndsWith("," Or "." Or "?" Or "!" Or ";" Or ":")
Printable View
How do I make an OR Statement.
Im trying to do this
Code:name3 = [name2].EndsWith("," Or "." Or "?" Or "!" Or ";" Or ":")
The Or goes between multiple EndsWith calls, not within one, e.g.Notice the use of OrElse rather than Or. Likewise you generally use AndAlso rather than And.vb.net Code:
If str.EndsWith(substr1) OrElse str.EndsWith(substr2) Then
Having said that, given that you are looking for substrings of the same length in each case, you could structure your code a little differently, e.g.The list you call Contains on can be any length and be constructed any way you like.vb.net Code:
If {substr1, substr2}.Contains(str.Substring(str.Length - substringLength)) Then