diff --git a/ical.NET/Serialization/iCalendar/iCalParser.cs b/ical.NET/Serialization/iCalendar/iCalParser.cs index 124fd1e7d..894c2e7ea 100644 --- a/ical.NET/Serialization/iCalendar/iCalParser.cs +++ b/ical.NET/Serialization/iCalendar/iCalParser.cs @@ -691,7 +691,7 @@ public string text_char() //throws RecognitionException, TokenStreamException public string text() //throws RecognitionException, TokenStreamException { - var s = string.Empty; + var sb = new StringBuilder(); { // ( ... )* for (;;) @@ -699,7 +699,7 @@ public string text() //throws RecognitionException, TokenStreamException if ((tokenSet_6_.member(LA(1)))) { var t = text_char(); - s += t; + sb.Append(t); } else { @@ -709,26 +709,25 @@ public string text() //throws RecognitionException, TokenStreamException _loop53_breakloop: ; } // ( ... )* - return s; + return sb.ToString(); } public string number() //throws RecognitionException, TokenStreamException { - var s = string.Empty; - + var sb = new StringBuilder(); var n1 = LT(1); match(NUMBER); - s += n1.getText(); + sb.Append(n1.getText()); { switch (LA(1)) { case DOT: { match(DOT); - s += "."; + sb.Append("."); var n2 = LT(1); match(NUMBER); - s += n2.getText(); + sb.Append(n2.getText()); break; } case EOF: @@ -742,25 +741,23 @@ public string number() //throws RecognitionException, TokenStreamException } } } - return s; + return sb.ToString(); } public string version_number() //throws RecognitionException, TokenStreamException { - //ToDo: StringBuilder - var s = string.Empty; - + var sb = new StringBuilder(); var t = number(); - s += t; + sb.Append(t); { switch (LA(1)) { case SEMICOLON: { match(SEMICOLON); - s += ";"; + sb.Append(";"); t = number(); - s += t; + sb.Append(t); break; } case EOF: @@ -773,7 +770,7 @@ public string version_number() //throws RecognitionException, TokenStreamExcepti } } } - return s; + return sb.ToString(); } public static readonly string[] tokenNames_ =