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


C# jStringBuilder.TrimEnd方法代码示例

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


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

示例1: RenderAttributes

		/// <summary>
		/// Renders the registered attributes to the provided jStringBuilder object.  The registered
		/// CSS classes and Style rules are also added at this point (as they're attributes as well really).
		/// </summary>
		protected internal void RenderAttributes(jStringBuilder sb) {
			bool hasID = _HtmlAttr.Keys.Any(x => x == "id");
			// force the ID to come out first (as this is what you're interested in 90% of the time)
			if (hasID) {
				sb.AppendFormat(" id=\"{0}\"", HttpUtility.HtmlAttributeEncode(_HtmlAttr["id"].ToString()) );
			}

			// add in any defined CSS classes
			if (_CssClasses.Any()) {
				sb.Append(" class=\"");
				sb.Append(this._CssClasses.ToSeparated(" ") );
				sb.Append("\"");
			}

			// add in the full style rules
			if (_Styles.Any()) {
				sb.Append(" style=\"");
				foreach (string key in this._Styles.Keys) {
					sb.AppendFormat("{0}:{1};", HttpUtility.HtmlAttributeEncode(key), HttpUtility.HtmlAttributeEncode(_Styles[key].ToString()) );
				}
				sb.TrimEnd(";");
				sb.Append("\"");
			}

			if (_HtmlAttr.Any()) {
				// avoid ID as this will already have been added
				foreach (string key in _HtmlAttr.Keys.Where(x => x != "id")) {
					sb.AppendFormat(" {0}=\"{1}\"", key, HttpUtility.HtmlAttributeEncode(_HtmlAttr[key].ToString()) );
				}
			}
		}
开发者ID:xuanvu,项目名称:Fluqi,代码行数:35,代码来源:ControlBase.cs


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