namespace TBL.CSharp.Base
{
public static partial class Extension
{
///
/// 将一个字符串重复 次
///
public static string Repeat(this string source, int count)
{
var result = string.Empty;
for (var i = 0; i < count; i++)
{
result += source;
}
return result;
}
///
/// 切换首字母大小写
///
public static unsafe string CaptionSwitch(this string str, bool isUpper)
{
if (str == null) return null;
var ret = string.Copy(str);
fixed (char* ptr = ret)
*ptr = isUpper ? char.ToUpper(*ptr) : char.ToLower(*ptr);
return ret;
}
}
}