public void Clean_KnownNickname_ReturnsFullname() { var valueToTest = "Al Jones"; var actual = cleaner.Clean(valueToTest); Console.WriteLine(String.Format("KnownNickname result = {0}", actual)); Assert.AreEqual("albert jones", actual); }
public string Clean(string value) { int i = value.IndexOf(','); if (i != -1) { value = value.Substring(i + 1) + " " + value.Substring(0, i); } var tmp = new char[value.Length * 2]; int pos = 0; for (int ix = 0; ix < value.Length; ix++) { tmp[pos++] = value[ix]; if (value[ix] == '.' && ix + 1 < value.Length && value[ix + 1] != ' ') { tmp[pos++] = ' '; } } return(_sub.Clean(new string(tmp, 0, pos))); }