Rasagar/Library/PackageCache/com.unity.ide.rider/Rider/Editor/Util/StringBuilderExtensions.cs

24 lines
619 B
C#
Raw Normal View History

2024-08-26 13:07:20 -07:00
using System.Collections.Generic;
using System.Text;
namespace Packages.Rider.Editor.Util
{
internal static class StringBuilderExtensions
{
// StringBuilder.AppendJoin is very useful, but not available in 2019.2
// It requires netstandard 2.1
public static StringBuilder CompatibleAppendJoin(this StringBuilder stringBuilder, char separator, IEnumerable<string> parts)
{
var first = true;
foreach (var part in parts)
{
if (!first) stringBuilder.Append(separator);
stringBuilder.Append(part);
first = false;
}
return stringBuilder;
}
}
}