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


C# StringBuilder.Append方法代码示例

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


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

示例1: DisplayData

		public void DisplayData(object[] data)
		{
			StringBuilder sb = new StringBuilder();
			sb.Append(view.uiHeaderTemplateHolder.InnerHTML.Unescape());
			if (data != null)
			{
				string currentGroupByFieldValue = "";
				for (int i = 0; i < data.Length; i++)
				{
					Dictionary dataItem = (Dictionary) data[i];
					if (GroupByField != "")
					{
						if (currentGroupByFieldValue != (string) dataItem[GroupByField])
						{
							currentGroupByFieldValue = (string) dataItem[GroupByField];
							sb.Append("<div class='ClientSideRepeaterGroupHeader'>" + currentGroupByFieldValue + "</div>");
						}
					}
					sb.Append(this.view.uiItemTemplate.Render(dataItem));
					if (i + 1 < data.Length)
					{
						sb.Append(view.uiBetweenTemplateHolder.InnerHTML.Unescape());
					}
				}
			}
			sb.Append(view.uiFooterTemplateHolder.InnerHTML.Unescape());
			view.uiContent.InnerHTML = sb.ToString();
		}
开发者ID:davelondon,项目名称:dontstayin,代码行数:28,代码来源:Controller.cs

示例2: maybeAppend1

 public static void maybeAppend1(String value_Renamed, StringBuilder result)
 {
     if (value_Renamed != null && value_Renamed.Length > 0)
     {
         // Don't add a newline before the first value
         if (result.ToString().Length > 0)
         {
             result.Append('\n');
         }
         result.Append(value_Renamed);
     }
 }
开发者ID:tomcat1234,项目名称:WebQRReader,代码行数:12,代码来源:ParsedResult.cs

示例3: Dump

 public string Dump()
 {
     lock(this)
     {
         StringBuilder buff = new StringBuilder();
         ArrayList al = rrdMap.Values;
         foreach (RrdEntry rrdEntry in al)
         {
             buff.Append(rrdEntry.Dump());
             buff.Append("\n");
         }
         return buff.ToString();
     }
 }
开发者ID:hirst,项目名称:rrdsharp,代码行数:14,代码来源:RrdDbPool.cs

示例4: decodeMiddle

        protected internal override int decodeMiddle(BitArray row, int[] startRange, StringBuilder result)
        {
            int[] counters = decodeMiddleCounters;
            counters[0] = 0;
            counters[1] = 0;
            counters[2] = 0;
            counters[3] = 0;
            int end = row.Size;
            int rowOffset = startRange[1];

            for (int x = 0; x < 4 && rowOffset < end; x++)
            {
                int bestMatch = decodeDigit(row, counters, rowOffset, L_PATTERNS);
                result.Append(Int32Extend.ToChar(CharExtend.ToInt32('0') + bestMatch));
                for (int i = 0; i < counters.Length; i++)
                {
                    rowOffset += counters[i];
                }
            }

            int[] middleRange = findGuardPattern(row, rowOffset, true, MIDDLE_PATTERN);
            rowOffset = middleRange[1];

            for (int x = 0; x < 4 && rowOffset < end; x++)
            {
                int bestMatch = decodeDigit(row, counters, rowOffset, L_PATTERNS);
                result.Append(Int32Extend.ToChar(CharExtend.ToInt32('0') + bestMatch));
                for (int i = 0; i < counters.Length; i++)
                {
                    rowOffset += counters[i];
                }
            }

            return rowOffset;
        }
开发者ID:tomcat1234,项目名称:WebQRReader,代码行数:35,代码来源:EAN8Reader.cs

示例5: ToGEOJson

        public static string ToGEOJson(this DataTable dt, string latColumn, string lngColumn)
        {
            StringBuilder result = new StringBuilder();
            StringBuilder line;

            foreach (DataRow r in dt.Rows)
            {
                line = new StringBuilder();

                foreach (DataColumn col in dt.Columns)
                {
                    if (col.ColumnName != latColumn && col.ColumnName != lngColumn)
                    {
                        string cValue = r[col].ToString();
                        line.Append(",\"" + col.ColumnName + "\":\"" + cValue.Replace("\"","\\\"") + "\"");
                    }

                }

                result.Append(
                    ",{\"type\":\"Feature\",\"geometry\": {\"type\":\"Point\", \"coordinates\": [" + r[lngColumn].ToString() + "," + r[latColumn].ToString() + "]},\"properties\":{" +
                    line.ToString().Substring(1) + "}}");

            }

            string geojson = "{\"type\": \"FeatureCollection\",\"features\": [" +
                result.ToString().Substring(1) + "]}";

            return geojson;
        }
开发者ID:Kartessian,项目名称:JSON-Sharp,代码行数:30,代码来源:extensions.cs

示例6: ReverseString

 public static string ReverseString(string s)
 {
     StringBuilder sb = new StringBuilder();
     for(int i = s.Length; i > 0; i--){
     sb.Append(s[i-1]);
     }
 }
开发者ID:franvarney,项目名称:cs-study,代码行数:7,代码来源:Solution.cs

示例7: ToString

        public override string ToString()
        {
            StringBuilder result = new StringBuilder();
            result.Append("LocalCourse { Name = ");
            result.Append(base.ToString());

            if (!string.IsNullOrEmpty(this.Lab))
            {
                result.Append("; Lab = ");
                result.Append(this.Lab);
            }

            result.Append(" }");

            return result.ToString();
        }
开发者ID:MiroslavVasilev,项目名称:HighQuality-Homework,代码行数:16,代码来源:LocalCourse.cs

示例8: DumpGraph

		private string DumpGraph(DirectedGraphImpl<string> gr)
		{
			StringBuilder sb = new StringBuilder();
			foreach (string n in gr.Nodes)
			{
				sb.AppendFormat("({0} s:(", n);
				foreach (string i in gr.Successors(n))
				{
					sb.AppendFormat("{0} ", i);
				}
				sb.Append(") p:( ");
				foreach (string p in gr.Predecessors(n))
				{
					sb.AppendFormat("{0} ", p);
				}
				sb.Append(")) ");
			}
			return sb.ToString();
		}
开发者ID:killbug2004,项目名称:reko,代码行数:19,代码来源:DirectedGraphImplTests.cs

示例9: ToString

 /// <summary>
 ///   Returns a <see cref="T:System.String" /> that represents the current <see cref="T:System.Object" />.
 /// </summary>
 /// <param name="baseUrl"> The base URL. </param>
 /// <returns> A <see cref="T:System.String" /> that represents the current <see cref="T:System.Object" /> . </returns>
 public virtual String ToString(String baseUrl)
 {
     var sb = new StringBuilder();
     foreach (var pair in _dictionary)
     {
         if (sb.Length > 0) sb.Append("&");
         sb.AppendFormat("{0}={1}", pair.Key, pair.Value);
     }
     return baseUrl.IsNotNullOrEmpty() ? String.Concat(baseUrl, "?", sb.ToString()) : sb.ToString();
 }
开发者ID:erashid,项目名称:Extensions,代码行数:15,代码来源:UriQueryString.cs

示例10: BytesToHexString

        /// <summary>
        /// Converts an array of bytes to a hex string representation.
        /// </summary>
        /// <param name="bytes"></param>
        /// <returns></returns>
        public static string BytesToHexString(this byte[] bytes)
        {
            var builder = new StringBuilder();

            foreach (byte b in bytes)
            {
                builder.Append(StringUtility.Format("{0:X}", b));
            }

            return builder.ToString();
        }
开发者ID:ukkiwisurfer,项目名称:Framework.Embedded,代码行数:16,代码来源:ByteArrayExtensions.cs

示例11: ConvertQueryHashtable

        /// <summary>
        /// Converts the query string to an string.
        /// </summary>
        /// <param name="data"></param>
        /// <param name="separator"></param>
        /// <param name="nameValueSeparator"></param>
        /// <returns></returns>
        public string ConvertQueryHashtable(Hashtable data, string separator, string nameValueSeparator)
        {
            // QueryString
            StringBuilder queryString = new StringBuilder();

            foreach ( DictionaryEntry de in data )
            {
                ArrayList itemValues = (ArrayList)de.Value;
                string key = (string)de.Key;

                if ( nameValueSeparator.Length == 0 )
                {
                    //queryString.Append(key);
                    queryString.Append(separator);
                    queryString.Append(itemValues[0]);
                }
                else
                {
                    foreach ( string s in itemValues )
                    {
                        queryString.Append(key);
                        queryString.Append(nameValueSeparator);
                        queryString.Append(s);
                        queryString.Append(separator);
                    }
                }
            }

            return queryString.ToString();
        }
开发者ID:molekilla,项目名称:Ecyware_GreenBlue_Inspector,代码行数:37,代码来源:UriParser.cs

示例12: GenerateRandomId

 public static string GenerateRandomId()
 {
     int maxSize = 36;
     char[] chars = new char[62];
     string a;
     a = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
     chars = a.ToCharArray();
     int size = maxSize;
     byte[] data = new byte[1];
     RNGCryptoServiceProvider crypto = new RNGCryptoServiceProvider();
     crypto.GetNonZeroBytes(data);
     size = maxSize;
     data = new byte[size];
     crypto.GetNonZeroBytes(data);
     StringBuilder result = new StringBuilder(size);
     foreach (byte b in data)
     { result.Append(chars[b % (chars.Length - 1)]); }
     return result.ToString();
 }
开发者ID:vanan08,项目名称:ADSoft,代码行数:19,代码来源:1447748420$Utils.cs

示例13: CalculateHash

        private static string CalculateHash(string input, HashAlgorithm hashAlgorithm)
        {
            byte[] inputBytes;
            byte[] hash;

            using (var hashProvider = hashAlgorithm)
            {
                inputBytes = Encoding.ASCII.GetBytes(input);
                hash = hashProvider.ComputeHash(inputBytes);
            }

            // step 2, convert byte array to hex string
            var sb = new StringBuilder();
            for (int i = 0; i < hash.Length; i++)
            {
                sb.Append(hash[i].ToString("X2", CultureInfo.InvariantCulture));
            }
            return sb.ToString();
        }
开发者ID:rag2111,项目名称:Hexa.Core,代码行数:19,代码来源:StringExtensions.cs

示例14: ToString

        public override string ToString()
        {
            StringBuilder result = new StringBuilder();
            result.Append("OffsiteCourse { Name = ");
            result.Append(base.ToString());

            result.Append("; Students = ");
            result.Append(this.GetStudentsAsString());
            if (!string.IsNullOrEmpty(this.Town))
            {
                result.Append("; Town = ");
                result.Append(this.Town);
            }

            result.Append(" }");

            return result.ToString();
        }
开发者ID:MiroslavVasilev,项目名称:HighQuality-Homework,代码行数:18,代码来源:OffsiteCourse.cs

示例15: ToString

 /// <summary>
 /// 	Returns a combined value of strings from a String array
 /// </summary>
 /// <param name = "values">The values.</param>
 /// <param name = "prefix">The prefix.</param>
 /// <param name = "suffix">The suffix.</param>
 /// <param name = "quotation">The quotation (or null).</param>
 /// <param name = "separator">The separator.</param>
 /// <returns>
 /// 	A <see cref = "System.String" /> that represents this instance.
 /// </returns>
 /// <remarks>
 /// 	Contributed by blaumeister, http://www.codeplex.com/site/users/view/blaumeiser
 /// </remarks>
 public static String ToString(this String[] values, String prefix = "(", String suffix = ")",
                               String quotation = "\"", String separator = ",")
 {
     var sb = new StringBuilder();
     sb.Append(prefix);
     for (var i = 0; i < values.Length; ++i)
     {
         if (i > 0) sb.Append(separator);
         if (quotation != null) sb.Append(quotation);
         sb.Append(values[i]);
         if (quotation != null) sb.Append(quotation);
     }
     sb.Append(suffix);
     return sb.ToString();
 }
开发者ID:erashid,项目名称:Extensions,代码行数:29,代码来源:StringArrayExtension.cs


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