fork(1) download
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4. using System.Diagnostics;
  5.  
  6. public class Test
  7. {
  8.  
  9. public static void Main()
  10. {
  11. string fullText = "**LOAD SUBCASE1 SUBTITLE2 LOAD SUBCASE3 SUBTITLE4 load Load Load**";
  12.  
  13. var words = fullText.Split().Select((w, i) => new{Word = w, Index = i});
  14. var matches = words.Where(w => StringComparer.OrdinalIgnoreCase.Equals("load", w.Word));
  15. var partialMatches = words.Where(w => w.Word.IndexOf("load", StringComparison.OrdinalIgnoreCase) != -1);
  16. foreach (var partialMatch in partialMatches)
  17. {
  18. Console.WriteLine("Index: {0}", partialMatch.Index);
  19. }
  20. }
  21. }
  22.  
  23.  
  24.  
Success #stdin #stdout 0.04s 33992KB
stdin
Standard input is empty
stdout
Index: 0
Index: 4
Index: 7
Index: 8
Index: 9