本文整理匯總了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);
}
}
示例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;
//.........這裏部分代碼省略.........