Answer by Jonathan Wood for Compare strings for equality
Here's a version that uses less LINQ than some of the other answers and might possibly be more performant.string GetEqualName(IEnumerable<string> strList){ StringBuilder builder = new...
View ArticleAnswer by Tim Schmelter for Compare strings for equality
Here's a different method which does what you want. I looks for the longest common substring from left to right using a HashSet<string>:string GetCommonStartsWith(IEnumerable<string>...
View ArticleAnswer by anaximander for Compare strings for equality
This little function does basically the same as your version, but shorter.string GetEqualName(IEnumerable<string> strList){ int limit = strList.Min(s => s.Length); int i = 0; for (; i <...
View ArticleAnswer by Servy for Compare strings for equality
You can Zip two strings together, take the pairs that are equal, and then create a string of those characters.public static string LargestCommonPrefix(string first, string second){ return new...
View ArticleCompare strings for equality
I want to compare a collection of strings and return the the equal parts until a not equal part occurs. (and remove traling whitespace).example:List<string> strList = new...
View Article
More Pages to Explore .....