Comments

  • The CompareWords function accepts two string arguments for comparison.
  • The comparison proceeds by comparing letters for the length of the shortest string.
  • The returned value is a string whose contents reflect the extent of a match. An empty string results in no match, and either partial or complete strings are returned for partial or complete matches. Thus, the hel and hello strings return hel, and the door and don't strings return do. Thus, the function returns a new string defining a letter-by-letter match from the first letter onward.

That's it! We've created a WordList class. Let's see the full source code for that:

//------------------------------------using UnityEngine;using System.Collections;using System.Collections.Generic; ...

Get Mastering Unity 2017 Game Development with C# - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.