当前位置: 首页>>代码示例>>C#>>正文


C# StringBuilder.ToStringUnixNewline方法代码示例

本文整理汇总了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();
 }
开发者ID:nofuture-git,项目名称:31g,代码行数:13,代码来源:Drawings.cs

示例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();
        }
开发者ID:nofuture-git,项目名称:31g,代码行数:58,代码来源:Drawings.cs

示例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();
        }
开发者ID:nofuture-git,项目名称:31g,代码行数:13,代码来源:Drawings.cs


注:本文中的StringBuilder.ToStringUnixNewline方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。