title: How to do cascade splitting with C# Linq - multiple foreach split
body: <p>These are the values i want to split the string cascadingly</p>
  
  <pre><code>List&lt;string&gt; lstsplitWord = new List&lt;string&gt; { ",", "=", "،", "أو", "او", "/", "." };
  </code></pre>
  
  <p>I have written them as like this but i am assuming that there must be more elegant Linq solution for this</p>
  
  <pre><code>    foreach(var part1 in srSplitPart.Split(',')) {
       foreach(var part2 in part1.Split('=')) {
        foreach(var part3 in part2.Split('،')) {
         foreach(var part4 in part3.func_Split_By_String("أو")) {
          foreach(var part5 in part4.func_Split_By_String("او")) {
           foreach(var part6 in part5.Split('/')) {
            foreach(var part7 in part6.Split('.')) {
             if (part7.Length &lt; 3)
              continue;
             string srTrans = part7.FixArabic().func_Special_Trim();
  
             srTemp.AppendLine($ "{srTitle} &gt; {srTrans} \t {irTransLevel}");
             irTransLevel++;
            }
           }
          }
         }
        }
       }
      }
  </code></pre>
  
  <p>C# .net 4.6.2</p>
  
  <p>special split function</p>
  
  <pre><code>public static List&lt;string&gt; func_Split_By_String(this string Sentence, string srReplace)
  {
      return Sentence.Split(new string[] { srReplace }, StringSplitOptions.None).ToList();
  }
  </code></pre>