private bool commandEndsWithSpace(string selection) { return selection.Length < textBoxSearch.Text.Length && textBoxSearch.Text.Substring(selection.Length, 1) == " "; }