本文整理汇总了C#中StringBuilder.ToStringUnixNewline方法的典型用法代码示例。如果您正苦于以下问题:C# StringBuilder.ToStringUnixNewline方法的具体用法?C# StringBuilder.ToStringUnixNewline怎么用?C# StringBuilder.ToStringUnixNewline使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringBuilder
的用法示例。
在下文中一共展示了StringBuilder.ToStringUnixNewline方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawHeader
protected internal virtual string DrawHeader()
{
var label = Util.Etc.PrintInCenter(Width, Title);
var bar = DrawBar();
var strBuilder = new StringBuilder();
for (var i = 0; i < Width; i++)
{
var headerChar = label[i] == (char)0x20 ? bar[i] : label[i];
strBuilder.Append(headerChar);
}
strBuilder.AppendLine();
return strBuilder.ToStringUnixNewline();
}
示例2: ToString
public override string ToString()
{
if (string.IsNullOrEmpty(Text))
return string.Empty;
if (Width == 0)
_width = Config.Numerics.DefaultWidth;
if (_height == 0)
_height = CalcHeight();
Func<int, string> sfOpL = i => "{0,-" + i + "}";
Func<int, string> sfOpR = i => "{0," + i + "}";
var strBuilder = new StringBuilder();
switch (Location)
{
case PrintLocation.Center:
strBuilder.AppendLine(Util.Etc.PrintInCenter(Width, Text));
break;
case PrintLocation.Left:
strBuilder.AppendLine(string.Format(sfOpL(Width), Text));
break;
case PrintLocation.Right:
strBuilder.AppendLine(string.Format(sfOpR(Width), Text.Trim()));
break;
}
if (_height <= 1)
return strBuilder.ToStringUnixNewline();
for (var i = 0; i < _height - 1; i++)
{
switch (Location)
{
case PrintLocation.Center:
strBuilder.AppendLine(Util.Etc.PrintInCenter(Width, Config.GraphChars.LifeLine.ToString()));
break;
case PrintLocation.Left:
strBuilder.AppendLine(string.Format(sfOpL(Width), Config.GraphChars.LifeLine));
break;
case PrintLocation.Right:
strBuilder.AppendLine(string.Format(sfOpR(Width), Config.GraphChars.LifeLine));
break;
}
}
switch (Location)
{
case PrintLocation.Center:
strBuilder.AppendLine(Util.Etc.PrintInCenter(Width, new string(Config.GraphChars.Rail,3)));
break;
case PrintLocation.Left:
strBuilder.AppendLine(string.Format(sfOpL(Width), new string(Config.GraphChars.Rail, 3)));
break;
case PrintLocation.Right:
strBuilder.AppendLine(string.Format(sfOpR(Width), new string(Config.GraphChars.Rail, 3)));
break;
}
return strBuilder.ToStringUnixNewline();
}
示例3: DrawBar
protected internal virtual string DrawBar()
{
var strBuilder = new StringBuilder();
strBuilder.Append(Config.GraphChars.BarRailIntersect);
for (var i = 1; i < Width - 1; i++)
{
strBuilder.Append(Config.GraphChars.Rail);
}
strBuilder.Append(Config.GraphChars.BarRailIntersect);
strBuilder.AppendLine();
return strBuilder.ToStringUnixNewline();
}