I would recommend regex for a clean way to get the title.
Regex regex = new Regex(@"^(Mr|Ms|Dr|Sr)\.");
Match match = regex.Match("Mr.ABC");
Console.WriteLine(match.Value);
More Related Contents:
- RegEx to remove single quote, parentheses or square bracket from both beginning and end of a string [closed]
- regular expression to find in wpf xaml [duplicate]
- RegEx to remove key and certificate headers and footers [duplicate]
- Regex for specific html tag in C# [duplicate]
- Get string between two strings in a string
- Regex.Match whole words
- Using RegEx to balance match parenthesis
- Using String Format to show decimal up to 2 places or simple integer
- Regular expression to remove HTML tags
- Regex to get NUMBER only from String
- C# regex to remove non – printable characters, and control characters, in a text that has a mix of many different languages, unicode letters
- Need to perform Wildcard (*,?, etc) search on a string using Regex
- Regular Expression for password validation
- Regex that matches a newline (\n) in C#
- Pad left with zeroes
- Multiline regular expression in C# [duplicate]
- Regex escape with \ or \\?
- Regex split string but keep separators
- RegEx – reusing subexpressions
- Case insensitive Regex without using RegexOptions enumeration
- Ignoring white space for a Regex match
- Validating file types by regular expression
- How to make a regex match case insensitive?
- How to remove empty lines from a formatted string
- Get values between curly braces c#
- Regular expression where part of string must be number between 0-100
- Replace non-numeric with empty string
- Regular expressions C# – is it possible to extract matches while matching?
- Parsing formatted string
- is there a elegant way to parse a word and add spaces before capital letters