Compare string in vb.net
how can i compare two string in vb.net?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Abhimanyu K VatsaPosted Jun 8, 2011, 3:28 AM
Further Reading:-
http://msdn.microsoft.com/en-us/library/fbh501kz.aspx#Y1200
Rohatash KumarPosted Jun 7, 2011, 8:48 AM
The VB.NET String Compare function is use to compare two String Objects.
Less than zero : str1 is less than str2
zero : str1 is equal to str2
Greater than zero : str1 is grater than str2
Module Module1
Sub Main()
Dim str1 As String
Dim str2 As String
str1 = "Rohatash"
str2 = "Rohatash"
Dim result As Integer
result = String.Compare(str1, str2)
Console.WriteLine(result)
result = String.Compare(str1, str2, True)
Console.WriteLine(result)
End Sub
End Module