@@ -13,7 +13,7 @@ public string Replace(string template, Dictionary<string, Func<string>> replacem
1313 var indexStarts = Task . Run ( ( ) => FindAll ( template , "{{" ) . ToArray ( ) ) ;
1414 var indexEnds = Task . Run ( ( ) => FindAll ( template , "}}" ) . ToArray ( ) ) ;
1515
16- _builder = new StringBuilder ( ) ;
16+ var builder = new StringBuilder ( ) ;
1717 Task . WaitAll ( indexStarts , indexEnds ) ;
1818
1919 int previousEnd = 0 ;
@@ -22,17 +22,17 @@ public string Replace(string template, Dictionary<string, Func<string>> replacem
2222 {
2323 if ( previousEnd < start )
2424 {
25- _builder . Append ( template . AsSpan ( previousEnd , start - previousEnd ) ) ;
25+ builder . Append ( template . AsSpan ( previousEnd , start - previousEnd ) ) ;
2626 }
2727
2828 var startToEnd = start + 2 ;
2929 var word = template . Substring ( startToEnd , end - startToEnd ) ;
30- _builder . Append ( GetWordReplacement ( word , replacements ) ) ;
30+ builder . Append ( GetWordReplacement ( word , replacements ) ) ;
3131
3232 previousEnd = end + 2 ;
3333 }
3434
35- return _builder . ToString ( ) ;
35+ return builder . ToString ( ) ;
3636 }
3737
3838 private string GetWordReplacement ( string word , Dictionary < string , Func < string > > replacement )
@@ -62,8 +62,6 @@ private IEnumerable<int> FindAll(string template, string characters)
6262 yield break ;
6363 }
6464
65- private StringBuilder _builder ;
66-
6765 // private readonly Regex _mustaches = new Regex("^{{(?<word>[\\w\\.]+)(?:\\[(?<index>\\d+)\\])?");
6866 private readonly Regex _index = new Regex ( "\\ [(?<idx>\\ d+)\\ ]" ) ;
6967 private readonly Dictionary < string , Func < string > > _commonReplacements = new Dictionary < string , Func < string > >
0 commit comments