A game about forced loneliness, made by TACStudios
1using System;
2using System.Text;
3
4namespace UnityEditor.ShaderGraph
5{
6 static class StringBuilderExtensions
7 {
8 public static void AppendIndentedLines(this StringBuilder sb, string lines, string indentation)
9 {
10 sb.EnsureCapacity(sb.Length + lines.Length);
11 var charIndex = 0;
12 while (charIndex < lines.Length)
13 {
14 var nextNewLineIndex = lines.IndexOf(Environment.NewLine, charIndex, StringComparison.Ordinal);
15 if (nextNewLineIndex == -1)
16 {
17 nextNewLineIndex = lines.Length;
18 }
19
20 sb.Append(indentation);
21
22 for (var i = charIndex; i < nextNewLineIndex; i++)
23 {
24 sb.Append(lines[i]);
25 }
26
27 sb.AppendLine();
28
29 charIndex = nextNewLineIndex + Environment.NewLine.Length;
30 }
31 }
32 }
33}