public static void Main()
GetHashCode("a b").Dump();
GetHashCode("ab").Dump();
GetHashCode(" a b").Dump();
GetHashCode("a b ").Dump();
public static int GetHashCode(string obj, bool CaseInsensitive = false)
for(int i = 0; i < obj.Length; ++i)
char ch = CaseInsensitive ? char.ToLowerInvariant(obj[i]) : obj[i];
if (char.IsWhiteSpace(ch))
int c = ch.GetHashCode() * (1 + i - wsc);
return hash1 + wsc - obj.Length;