开发者

Using String.Equals in VB.net

开发者 https://www.devze.com 2023-03-31 06:43 出处:网络
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 compa

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消