c# - Can LINQ be used to pull keywords out of a string? -


if have long-ish string of text , wanted pull out words greater 4 characters in length , found more 4 times in string, can linq that?

you may able tighten up, believe effect of

var results = inputstring.split()                 .where(word => word.length > 4)                 .groupby(word => word)                 .where(grp => grp.count() > 4)                 .select(grp => grp.key); 

you will, of course, need decide how wish deal punctuation might present.

so given input

var inputstring = @"the quick brown fox jumped on lazy dog                 quick brown fox jumped on lazy dog                 quick fox jumped on lazy dog                 quick fox jumped on lazy dog                 quick brown fox jumped on lazy dog"; 

the results contain "quick" , "jumped" because other word greater 4 characters ("brown") appeared 3 times.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -