blob: 0e0bc4282e4066664af552e07e1e826bbbc90cf0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
using System.Collections.Generic;
using System.Text;
namespace MediaBrowser.Common.Extensions
{
/// <summary>
/// Extension methods for the <see cref="StringBuilder"/> class.
/// </summary>
public static class StringBuilderExtensions
{
/// <summary>
/// Concatenates and appends the members of a collection in single quotes using the specified delimiter.
/// </summary>
/// <param name="builder">The string builder.</param>
/// <param name="delimiter">The character delimiter.</param>
/// <param name="values">The collection of strings to concatenate.</param>
/// <returns>The updated string builder.</returns>
public static StringBuilder AppendJoinInSingleQuotes(this StringBuilder builder, char delimiter, IReadOnlyList<string> values)
{
for (var i = 0; i < values.Count; i++)
{
builder.Append('\'')
.Append(values[i])
.Append('\'')
.Append(delimiter);
}
// remove last ,
builder.Length--;
return builder;
}
}
}
|