1
This commit is contained in:
44
Core/Extensions/String.cs
Normal file
44
Core/Extensions/String.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user