//
// Copyright (c) PlaceholderCompany. All rights reserved.
//
namespace Jellyfin.Extensions
{
using System;
using System.Collections.Generic;
using System.Text;
///
/// Extension methods for the class.
///
public static class StringBuilderExtensions
{
///
/// Concatenates and appends the members of a collection in single quotes using the specified delimiter.
///
/// The string builder.
/// The character delimiter.
/// The collection of strings to concatenate.
/// The updated string builder.
public static StringBuilder AppendJoinInSingleQuotes(this StringBuilder builder, char delimiter, IReadOnlyList values)
{
ArgumentNullException.ThrowIfNull(values);
var len = values.Count;
for (var i = 0; i < len; i++)
{
ArgumentNullException.ThrowIfNull(builder);
builder.Append('\'')
.Append(values[i])
.Append('\'')
.Append(delimiter);
}
// remove last ,
ArgumentNullException.ThrowIfNull(builder);
builder.Length--;
return builder;
}
}
}