This seems like a fairly simple problem, but the solution is eluding me:
If I have the following two strings:
string str1 = "Ping";
string str2 = "Pong";
I’m needing an algorithm to create a unique value for the two strings, no matter what order they are in. For example:
UniqueValue(str1, str2) and UniqueValue(str2, str1) should return the exact same value.
EDIT: UniqueValue returns a string. I understand it won’t be “truly” unique, but a hash-like value will work.
Thanks,
Tyler
Sort the strings.
Convert
/to//and;to/;in each of the strings.Concatenate the strings, putting a
;between each.