|
-
Apr 8th, 2015, 10:42 AM
#5
Re: Regex Help
 Originally Posted by dday9
LINQ would work in this case too:
Code:
Private Function GetMostOccuringWord(ByVal input As String) As String
Dim sentence() As String = input.Split({" "}, StringSplitOptions.RemoveEmptyEntries)
Return sentence.GroupBy(Function(n) n).OrderByDescending(Function(g) g.Count).Select(Function(g) g.Key).FirstOrDefault
End Function
I was waiting for someone to whip up a Linq version. Very nice. I really need to learn Linq well.
If you find my contributions helpful then rate them. 
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|