41 lines
1.1 KiB
C#
41 lines
1.1 KiB
C#
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace BITKit
|
|
{
|
|
public static partial class Extensions
|
|
{
|
|
public static string Combine(this string[] self)
|
|
{
|
|
if (self.IsNull())
|
|
{
|
|
return string.Empty;
|
|
}
|
|
StringBuilder stringBuilder = new();
|
|
self.ForEach(x =>
|
|
{
|
|
stringBuilder.Append(x);
|
|
});
|
|
return stringBuilder.ToString();
|
|
}
|
|
public static string Combine(this IEnumerable<string> self, bool split = false)
|
|
{
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
if (self.IsNull())
|
|
{
|
|
return string.Empty;
|
|
}
|
|
self.ForEach(x =>
|
|
{
|
|
stringBuilder.Append(x);
|
|
stringBuilder.Append(" ");
|
|
if (split)
|
|
{
|
|
stringBuilder.Append("\n");
|
|
}
|
|
});
|
|
return stringBuilder.ToString();
|
|
}
|
|
public static string GetType<T>(this string self) => Generic<T>.GetVariable(self);
|
|
}
|
|
} |