private string GetDisplayedText(string description) { diff_match_patch dmp = new diff_match_patch(); string outputText = ""; int correctPosition = dmp.match_main(wordString, description, wordString.Length / 2); if (correctPosition != -1) // find location in wordString corresponding to start of desired word { int prev = 0; foreach (int n in placesToWords.Keys) { if (n <= correctPosition) { prev = n; } else { correctPosition = prev; break; } } } Debug.Log("og txt: " + description); Debug.Log(correctPosition); string correctText; try { correctText = placesToWords[correctPosition]; } catch { correctText = "Error, try again.\n" + description; } if (description.Equals(correctText)) { outputText = "<color=lime>" + correctText + "</color>"; } else { List <Diff> diffs = dmp.diff_main(correctText, description, false); foreach (var d in diffs) { Debug.Log(d.ToString()); if (d.operation.Equals(Operation.DELETE))//equals insertion { outputText += "<color=red>" + d.text + "</color>"; } else if (d.operation.Equals(Operation.EQUAL))//equals equality { outputText += d.text; } } } return(outputText); }