public ParsedName Parse(string rawName) { var match = Rx.Match(rawName); if (!match.Success) { return(null); } var firstName = match.Groups["first"].Value; if (!FirstNames.Contains(firstName.ToLowerInvariant())) { return(null); } var pn = new ParsedName(this.GetType().Name) { Title = match.Groups["title"].Value, FirstName = match.Groups["first"].Value, LastName = $"{match.Groups["last1"].Value} {match.Groups["last2"].Value}", DisplayName = $"{match.Groups["first"].Value} {match.Groups["last1"].Value} {match.Groups["last2"].Value}", Score = 100 }; return(pn); }
public ParsedFullName Parse(string rawName) { var match = Rx.Match(rawName); if (!match.Success) { return(null); } var firstName1 = match.Groups["first1"].Value; var firstName2 = match.Groups["first2"].Value; if (!FirstNames.Contains(firstName1.ToLowerInvariant())) { return(null); } if (!FirstNames.Contains(firstName2.ToLowerInvariant())) { return(null); } var pn = new ParsedFullName { Title = match.Groups["title"].Value, FirstName = $"{match.Groups["first1"].Value}-{match.Groups["first2"].Value}", LastName = match.Groups["last"].Value, DisplayName = $"{match.Groups["first1"].Value}-{match.Groups["first2"].Value} {match.Groups["last"].Value}", Score = 200 }; return(pn); }
public ParsedName Parse(string rawName) { var match = Rx.Match(rawName); if (!match.Success) { return(null); } var firstName = match.Groups["first"].Value; if (!FirstNames.Contains(firstName)) { return(null); } var pn = new ParsedName { FirstName = match.Groups["first"].Value, LastName = $"{match.Groups["last1"].Value} {match.Groups["last2"].Value}", DisplayName = $"{match.Groups["first"].Value} {match.Groups["last1"].Value} {match.Groups["last2"].Value}", Score = 100 }; return(pn); }