tracks/csharp/generators/Output/FormattingExtensions.cs in trackler-2.2.1.43 vs tracks/csharp/generators/Output/FormattingExtensions.cs in trackler-2.2.1.44
- old
+ new
@@ -1,6 +1,9 @@
-namespace Generators.Output
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Generators.Output
{
public static class FormattingExtensions
{
public static string Indent(this string str, int level = 1) => $"{new string(' ', 4 * level)}{str}";
@@ -9,7 +12,14 @@
.Replace("\t", "\\t")
.Replace("\r", "\\r")
.Replace("\"", "\\\"");
public static string Quote(this string s) => $"\"{s}\"";
+
+ public static IEnumerable<string> AddTrailingSemicolon(this IEnumerable<string> enumerable)
+ {
+ var array = enumerable.ToArray();
+ array[array.Length - 1] += ";";
+ return array;
+ }
}
}