string-compare

bash, dash and string comparison

While writing a fairly simple shell script, I've tried to compare two strings. I was using /bin/sh instead of /bin/bash, and after countless hours of debugging, it turns out dash (which is actually dash) can't handle this block of code: if [ "$var" == "string" ] then do something fi What is a portable way to compare strings uding...

Why does string.Compare seem to handle accented characters inconsistently?

If I execute the following statement: string.Compare("mun", "mün", true, CultureInfo.InvariantCulture) The result is '-1', indicating that 'mun' has a lower numeric value than 'mün'. However, if I execute this statement: string.Compare("Muntelier, Schweiz", "München, Deutschland", true, CultureInfo.InvariantCulture) I get '1', ind...

string.Compare behavior

How this can be ? (This is taken from the immediate window in VS2008) ?string.Compare("-", "+") -1 ?string.Compare("-0", "+0") 1 ...

How does .NET compiler compare two strings?

string a="I am comparing 2 string"; string b="I am comparing 2 string"; if(a==b) return true; else return false; How does a .NET compiler compare two strings? Does a string work like a struct(int)? string is class so a=b means we are comparing 2 object, but i want to compare 2 values. ...