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


C# LineInfo.TrimRight方法代码示例

本文整理汇总了C#中LineInfo.TrimRight方法的典型用法代码示例。如果您正苦于以下问题:C# LineInfo.TrimRight方法的具体用法?C# LineInfo.TrimRight怎么用?C# LineInfo.TrimRight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LineInfo的用法示例。


在下文中一共展示了LineInfo.TrimRight方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IsMultiLine

        /// <summary>
        /// Determines if this node spans over multiple lines.
        /// </summary>
        /// <param name="line">contains line information (and text)</param>
        /// <param name="isContinued">true if the previous line was continued.</param>
        /// <returns>true if this line continues onto the next.</returns>
        public override bool IsMultiLine(LineInfo line, bool isContinued)
        {
            string trimmed = line.Data.TrimEnd();
            if (trimmed.Length == 0)
                return false;

            if (trimmed.EndsWith("|"))
            {
                line.TrimRight(1);
                return true;
            }

            return false;
        }
开发者ID:kf6kjg,项目名称:halcyon,代码行数:20,代码来源:NewLineRule.cs

示例2: IsMultiLine

        /// <summary>
        /// Determines if this node spans over multiple lines.
        /// </summary>
        /// <param name="line">contains line information (and text)</param>
        /// <param name="isContinued">true if the previous line was continued.</param>
        /// <returns>true if this line continues onto the next.</returns>
        public override bool IsMultiLine(LineInfo line, bool isContinued)
        {
            // hack to dont include code
            // a more proper way would have bene to scan after each tag
            if (!isContinued)
            {
                char ch = line.Data[0];
                if (ch != '#' && ch != '%' && ch != '.')
                    return false;
            }

            bool inQuote = false;
            bool inAttribute = false;
            if (isContinued && line.Data.IndexOf('{') == -1)
                inAttribute = true;
            foreach (char ch in line.Data)
            {
                if (ch == '"')
                    inQuote = !inQuote;
                else if (ch == '{' && !inQuote)
                {
                    if (inAttribute)
						throw new CodeGeneratorException(line.LineNumber, line.Data,
                            "Found another start of attributes, but no close tag. Have you forgot one '}'?");
                    inAttribute = true;
                }
                else if (ch == '}' && !inQuote)
                    inAttribute = false;
            }

            if (inQuote)
				throw new CodeGeneratorException(line.LineNumber, line.Data, "Attribute quotes can not span over multiple lines.");

            if (inAttribute)
            {
                //todo: Attach a log writer.
                //Console.WriteLine("Attribute is not closed, setting unfinished rule");
                line.UnfinishedRule = this;

            	line.Data.TrimEnd();
				if (line.Data.EndsWith("|"))
					line.TrimRight(1);
				
				return true;
            }

            return inAttribute;
        }
开发者ID:kow,项目名称:Aurora-Sim,代码行数:54,代码来源:AttributesRule.cs


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