Note that there are some explanatory texts on larger screens.

plurals
  1. POSearch words in list of structs and get all words with postfix
    text
    copied!<p>My question for today is:<br />How can I make function that could find all words matching the pattern?</p> <p>For example we have word: <code>duck</code> and we want find all words starting from that word duck.</p> <p>I am looking for best perfomance function, I would be glad if it could be using LINQ. So far I made something like that (it doesn't work yet):</p> <pre><code>public List&lt;List&lt;string&gt;&gt; FindWordsPostfix(List&lt;Parameters.Words&gt; wordsChess, List&lt;string&gt; wordsFromDictionary, int width) { List&lt;List&lt;string&gt;&gt; listPostfixForstructxIndex = new List&lt;List&lt;string&gt;&gt;(); foreach (Parameters.Words structx in wordsChess) { //1for each structx I have some parameters eg. name, length, index //2for each word (name) I need find word from dict. starting that word(name) //list storing lists of words for each of the structx object List&lt;string&gt; list = new List&lt;string&gt;(); foreach (String wordDictionary in wordsFromDictionary) { Match match = Regex.Match(wordDictionary, structx.word, RegexOptions.IgnoreCase); if(match.Success &amp;&amp; (match.Length &gt; structx.length)) { list.Add(match.Value); } } //add list of words to main list listPostfixForstructxIndex.Add(list); } throw new NotImplementedException(); } </code></pre> <p><code>Parameters.Words</code> is a struct containing: <code>string name, int length, etc..</code>.</p> <p>Why my function is bad and doesn't storing any data?</p> <p>PS2. I edited the question. I had to clean up that mess what I did.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload