c# - same String is not equal to another -
c# - same String is not equal to another -
string s =@"­"; string r = httputility.htmldecode(s); string r3 = string.format("1{0}jan{0}2007",r); console.writeline(r3); if(r3 == "1-jan-2007") { console.writeline("equal"); console.writeline("1-jan-2007"); } else { console.writeline("not equal"); console.writeline("1-jan-2007"); }
the output
1-jan-2007 not equal 1-jan-2007
but when replace r "-" i.e string.format("1{0}jan{0}2007","-"); output
1-jan-2007 equal 1-jan-2007
­
unicode character 'soft hyphen' (u+00ad). although looks similar unicode character 'hyphen-minus' (u+002d), 2 characters not same.
c#
Comments
Post a Comment