To determine if a string has unique characters or not, firstly check a word in the string with the next word −
for (int j = i + 1; j < val.Length; j++) { if (val[i] == val[j]) }
If you find a match, that would mean the string do not have unique characters.
If you are unable to find a match, then the string has all unique characters.
In case of a match, return false i.e. unique characters not found −
for (int j = i + 1; j < val.Length; j++) { if (val[i] == val[j]) return false; }