Using String.Equals in VB.net
I am comapring 2 contract IDs, one is sent by the calle开发者_JAVA技巧r, the other is in a file and read into a variable. I use a string.Equals method to compare the contract IDs. The contract IDs compare successfully if the number in a contract ID is more than 1 away from the the other for example:
CTSRG0006 & CTSRG0005 = false
However CTSRG0006 & CTSRG0007 = true
the code I am using for the comparison:
If fileContractID.Equals(calledContractID) Then
isFileValid = True
End If
If you are comparing strings, then:
isFileValid = fileContractID.Equals(calledContractID)
...should produce the values you desire. If not, then I would be checking to ensure there are no extra spaces in either of the values, or some other hidden characters.
精彩评论