fork(27) download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. var value =
  9. "super exemple of string key : text I want to keep - end of my string"
  10. .Between(
  11. "key : ",
  12. " - ");
  13.  
  14. Console.WriteLine(value);
  15. }
  16. }
  17.  
  18. public static class Ext
  19. {
  20. static string Between(this System.String source, string left, string right)
  21. {
  22. return Regex.Match(
  23. source,
  24. string.Format("{0}(.*){1}", left, right))
  25. .Groups[1].Value;
  26. }
  27. }
Compilation error #stdin compilation error #stdout 0.08s 24488KB
stdin
Standard input is empty
compilation info
prog.cs(10,7): error CS1061: Type `string' does not contain a definition for `Between' and no extension method `Between' of type `string' could be found. Are you missing an assembly reference?
/usr/lib/mono/4.5/mscorlib.dll (Location of the symbol related to previous error)
Compilation failed: 1 error(s), 0 warnings
stdout
Standard output is empty