Пример #1
0
 public string ItReplaces(string input, int offset, int length, string with)
 {
     return(RegexParser.Replace(input, new RegexParser.TextSpan()
     {
         Offset = offset, Length = length
     }, with));
 }
Пример #2
0
 internal static string ParseTitle(string title, IList <StatementParameter> parameters)
 {
     //Condition this to look a lot prettier
     title = title.StartsWith("^") ? title.Substring(1) : title;
     title = title.EndsWith("$") ? title.Substring(0, title.Length - 1) : title;
     title = title.Replace(@"\s+", " ").Replace(@"\s*", " ").ConsolidateWhitespace();
     foreach (var param in parameters)
     {
         var span = RegexParser.FirstGroup(title);
         if (span == null)
         {
             break;
         }
         title = RegexParser.Replace(title, span.Value, "[" + param.Name + "]");
     }
     return(title);
 }