Compare string in vb.net
how can i compare two string in vb.net?
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Rohatash KumarRank #12 · 57.7K reputationPosted Jun 7, 2011, 4:48 AM EDT
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
Abhimanyu K VatsaRank #14 · 51.7K reputationPosted Jun 7, 2011, 11:28 PM EDT
Further Reading:-
http://msdn.microsoft.com/en-us/library/fbh501kz.aspx#Y1200