0
,比如我有兩個字符串0000和0001則如何比較兩個字符串,並更換不同的位 - 在另一個字符串
0000
0001
----
result= 000- here difference is indicated by - sign
,比如我有兩個字符串0000和0001則如何比較兩個字符串,並更換不同的位 - 在另一個字符串
0000
0001
----
result= 000- here difference is indicated by - sign
您可以比較每個字符串中的字符:
Dim s1 = "0000"
Dim s2 = "0001"
Dim result = ""
If s1.Length = s2.Length Then
For a = 0 To s1.Length - 1
If s1(a) <> s2(a) Then
result &= "-"
Else
result &= s1(a)
End If
Next
End If
結果= 000-
感謝兄弟.. :) – 2010-10-29 20:44:27