unity – Remove hidden values ​​in chain

The documentation for String.Trim () tells us

The white space characters are defined by the Unicode standard. The Trim () method removes the leading and trailing characters that produce a true return value when passed to the Char.IsWhiteSpace method.

One option is to use the String.Trim overload (Char[]) to specify characters that you do not expect. To debug, you could iterate over the string by printing each character and the corresponding result of Char.IsWhiteSpace.

Please consider refactor too.

private chain[] FisherShuffle (chain)[] words) {
int len ​​= words.Longitude;
int i;
tmp string;

while (len> 0) {
i = (int) Random.Range (0, (float) len);
len--;

tmp = words[len].Trim();
words[len] = words[i];
words[i] = tmp;
}
return words;
}