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


C# StringBuilder.Length方法代码示例

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


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

示例1: ParseSupportsRule

        // supports_rule
        //   : "@supports" supports_condition group_rule_body
        //   ;
        internal bool ParseSupportsRule(RuleAppendFunc aAppendFunc, object aProcessData)
        {
            bool conditionMet = false;
              var condition = new StringBuilder();

              mScanner.StartRecording();
              bool parsed = ParseSupportsCondition(ref conditionMet);

              if (!parsed) {
            mScanner.StopRecording();
            return false;
              }

              if (!ExpectSymbol('{', true)) {
            { if (!mSuppressErrors) mReporter.ReportUnexpected("PESupportsGroupRuleStart", mToken); };
            mScanner.StopRecording();
            return false;
              }

              UngetToken();
              mScanner.StopRecording(condition);

              // Remove the "{" that would follow the condition.
              if (condition.Length() != 0) {
            condition.Truncate(condition.Length() - 1);
              }

              // Remove spaces from the start and end of the recorded supports condition.
              condition.Trim(" ", true, true, false);

              // Record whether we are in a failing @supports, so that property parse
              // errors don't get reported.
              using (/*var failing = */new nsAutoFailingSupportsRule(this, conditionMet)) {

            GroupRule rule = new CSSSupportsRule(ref conditionMet, condition);
            return ParseGroupRule(rule, aAppendFunc, aProcessData);
              }
        }
开发者ID:jorik041,项目名称:CsCss,代码行数:41,代码来源:nsCSSParser.conv.cs

示例2: AppendToString

        /**
         * Append the textual representation of |this| to |aBuffer|.
         */
        internal void AppendToString(StringBuilder aBuffer)
        {
            switch (mType) {
            case nsCSSTokenType.Ident:
              nsStyleUtil.AppendEscapedCSSIdent(mIdent, aBuffer);
              break;

            case nsCSSTokenType.AtKeyword:
              aBuffer.Append('@');
              nsStyleUtil.AppendEscapedCSSIdent(mIdent, aBuffer);
              break;

            case nsCSSTokenType.ID:
            case nsCSSTokenType.Hash:
              aBuffer.Append('#');
              nsStyleUtil.AppendEscapedCSSIdent(mIdent, aBuffer);
              break;

            case nsCSSTokenType.Function:
              nsStyleUtil.AppendEscapedCSSIdent(mIdent, aBuffer);
              aBuffer.Append('(');
              break;

            case nsCSSTokenType.URL:
            case nsCSSTokenType.Bad_URL:
              aBuffer.AppendLiteral("url(");
              if (mSymbol != ((PRUnichar)(0))) {
                nsStyleUtil.AppendEscapedCSSString(mIdent, aBuffer, mSymbol);
              } else {
                aBuffer.Append(mIdent);
              }
              if (mType == nsCSSTokenType.URL) {
                aBuffer.Append(((PRUnichar)(')')));
              }
              break;

            case nsCSSTokenType.Number:
              if (mIntegerValid) {
                aBuffer.AppendInt(mInteger, 10);
              } else {
                aBuffer.AppendFloat(mNumber);
              }
              break;

            case nsCSSTokenType.Percentage:
              aBuffer.AppendFloat(mNumber * 100.0f);
              aBuffer.Append(((PRUnichar)('%')));
              break;

            case nsCSSTokenType.Dimension:
              if (mIntegerValid) {
                aBuffer.AppendInt(mInteger, 10);
              } else {
                aBuffer.AppendFloat(mNumber);
              }
              nsStyleUtil.AppendEscapedCSSIdent(mIdent, aBuffer);
              break;

            case nsCSSTokenType.Bad_String:
              nsStyleUtil.AppendEscapedCSSString(mIdent, aBuffer, mSymbol);
              // remove the trailing quote character
              aBuffer.Truncate(aBuffer.Length() - 1);
              break;

            case nsCSSTokenType.String:
              nsStyleUtil.AppendEscapedCSSString(mIdent, aBuffer, mSymbol);
              break;

            case nsCSSTokenType.Symbol:
              aBuffer.Append(mSymbol);
              break;

            case nsCSSTokenType.Whitespace:
              aBuffer.Append(' ');
              break;

            case nsCSSTokenType.HTMLComment:
            case nsCSSTokenType.URange:
              aBuffer.Append(mIdent);
              break;

            case nsCSSTokenType.Includes:
              aBuffer.AppendLiteral("~=");
              break;
            case nsCSSTokenType.Dashmatch:
              aBuffer.AppendLiteral("|=");
              break;
            case nsCSSTokenType.Beginsmatch:
              aBuffer.AppendLiteral("^=");
              break;
            case nsCSSTokenType.Endsmatch:
              aBuffer.AppendLiteral("$=");
              break;
            case nsCSSTokenType.Containsmatch:
              aBuffer.AppendLiteral("*=");
              break;

//.........这里部分代码省略.........
开发者ID:rexwhitten,项目名称:CsCss,代码行数:101,代码来源:CssToken.conv.cs


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