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

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -