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


C# System.Text.StringBuilder.ToString方法代码示例

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


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

示例1: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            //To capturing the variables passed from the AJAX call
            string strSearch = CareerCruisingWeb.CCLib.Common.Strings.GetQueryString("Search");
            string strPartnerSignUpConSysID = CareerCruisingWeb.CCLib.Common.Strings.GetQueryString("CSID");
            System.Text.StringBuilder strResponse = new System.Text.StringBuilder();
            if ((strSearch != "")&&(strPartnerSignUpConSysID!=""))
            {
                if (strSearch.ToUpper() == "NUM")
                { strSQL = "SELECT CompanyID,CompanyName FROM Con_CompanyProfiles  WHERE (CompanyStatusID!=4 and CompanyStatusID!=6) and ConSysID=" + strPartnerSignUpConSysID + " and ((CompanyName LIKE '1%') or (CompanyName LIKE '2%') or (CompanyName LIKE '3%') or (CompanyName LIKE '4%') or (CompanyName LIKE '5%') or (CompanyName LIKE '6%') or (CompanyName LIKE '7%') or (CompanyName LIKE '8%') or (CompanyName LIKE '9%')) ORDER BY CompanyName"; }
                else
                {
                    strSQL = "SELECT CompanyID,CompanyName FROM Con_CompanyProfiles  WHERE (CompanyStatusID!=4 and CompanyStatusID!=6) and ConSysID=" + strPartnerSignUpConSysID + " and (CompanyName LIKE '" + strSearch + "%') ORDER BY CompanyName";
                    //strSQL = "SELECT cp.CompanyID,cp.CompanyName FROM Con_CompanyProfiles as cp  WHERE  (cp.CompanyName LIKE '" + strSearch + "%') ORDER BY cp.CompanyName";
                }

                DataTable dtCompanyInfo = CareerCruisingWeb.CCLib.Common.DataAccess.GetDataTable(strSQL);
                if (dtCompanyInfo.Rows.Count > 0)
                {
                    int rowCount = dtCompanyInfo.Rows.Count;

                    strResponse.Append("<table align='center' style='width:100%;' cellpadding='3' cellspacing='0'>");

                    for (int i = 0; i < rowCount; i++)
                    {
                        strResponse.Append("<tr>");
                        strResponse.Append("<td valign='top' style='width:33%;padding-top:10px;padding-left:20px;'><a href='Javascript:UpdateTextBox(" + dtCompanyInfo.Rows[i]["CompanyID"].ToString() + ",\"" + dtCompanyInfo.Rows[i]["CompanyName"].ToString().Replace("'", "`") + "\");'>" + dtCompanyInfo.Rows[i]["CompanyName"].ToString() + "</a></td>");
                        i++;
                        if (i < rowCount)
                        {
                            strResponse.Append("<td valign='top' style='width:33%;padding-top:10px;padding-left:20px;'><a href='Javascript:UpdateTextBox(" + dtCompanyInfo.Rows[i]["CompanyID"].ToString() + ",\"" + dtCompanyInfo.Rows[i]["CompanyName"].ToString().Replace("'", "`") + "\");'>" + dtCompanyInfo.Rows[i]["CompanyName"].ToString() + "</a></td>");
                            i++;
                        }
                        if (i < rowCount)
                        {
                            strResponse.Append("<td valign='top' style='padding-top:10px;padding-left:20px;'><a href='Javascript:UpdateTextBox(" + dtCompanyInfo.Rows[i]["CompanyID"].ToString() + ",\"" + dtCompanyInfo.Rows[i]["CompanyName"].ToString().Replace("'", "`") + "\");'>" + dtCompanyInfo.Rows[i]["CompanyName"].ToString() + "</a></td>");
                        }
                        else { strResponse.Append("<td>&nbsp;</td>"); }
                        strResponse.Append("</tr>");
                    }
                    strResponse.Append("</table>");
                    Response.Clear();
                    Response.Write(strResponse.ToString());
                    Response.End();
                }
                else
                {
                    strResponse.Append("<table align='center' style='width:100%;' cellpadding='3' cellspacing='0'><tr><td>&nbsp;</td></tr></table>");
                    Response.Clear();
                    Response.Write(strResponse.ToString());
                    Response.End();
                }

            }
            else
            {
                Response.Clear();
                Response.End();
            }
        }
开发者ID:nehawadhwa,项目名称:ccweb,代码行数:60,代码来源:PopupCompanyList.aspx.cs

示例2: compressStr

 public static string compressStr(string str)
 {
     if (str.Length <= 1)
     {
         return str;
     }
     System.Text.StringBuilder sb = new System.Text.StringBuilder();
     char last = str[0];
     int count = 1;
     for (int i = 0; i < str.Length; i++)
     {
         if (str[i].Equals(last))
         {
             count++;
         }
         else
         {
             sb.Append(last).Append(count);
             count = 1;
             last = str[i];
         }
     }
     sb.Append(last).Append(count);
     if (sb.ToString().Length >= str.Length)
     {
         return str;
     }
     else
     {
         return sb.ToString();
     }
 }
开发者ID:Sanqiang,项目名称:Algorithm-Win,代码行数:32,代码来源:CCN1_5.cs

示例3: GetCashSelectModel

        public SelectModel GetCashSelectModel(int pageIndex, int pageSize, string orderStr, int pledgeApplyId)
        {
            NFMT.Common.SelectModel select = new NFMT.Common.SelectModel();

            select.PageIndex = pageIndex;
            select.PageSize = pageSize;
            if (string.IsNullOrEmpty(orderStr))
                select.OrderStr = "psd.ContractNo desc";
            else
                select.OrderStr = orderStr;

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append(" psd.ContractNo as StockContractNo,psd.Deadline,SUM(Hands) as Hands,bank.BankName as AccountName ");
            select.ColumnName = sb.ToString();

            sb.Clear();
            sb.Append(" dbo.Fin_PledgeApply pa ");
            sb.AppendFormat(" inner join dbo.Fin_PledgeApplyStockDetail psd on pa.PledgeApplyId = psd.PledgeApplyId and psd.DetailStatus ={0} ", (int)Common.StatusEnum.已生效);
            sb.Append(" left join NFMT_Basic..Bank bank on pa.FinancingBankId = bank.BankId ");
            select.TableName = sb.ToString();

            sb.Clear();
            sb.AppendFormat(" pa.PledgeApplyId ={0} group by psd.ContractNo,psd.Deadline,bank.BankName ", pledgeApplyId);

            select.WhereStr = sb.ToString();

            return select;
        }
开发者ID:weiliji,项目名称:NFMT,代码行数:28,代码来源:PledgeApplyCashDetailBLL.cs

示例4: Test1

		/// <exception cref="System.Exception"></exception>
		public virtual void Test1()
		{
			NeoDatis.Odb.ODB odb = Open("big-data.neodatis");
			System.Text.StringBuilder buffer = new System.Text.StringBuilder();
			for (int i = 0; i < 30000; i++)
			{
				buffer.Append('a');
			}
			NeoDatis.Odb.Test.VO.Login.Function function = new NeoDatis.Odb.Test.VO.Login.Function
				(buffer.ToString());
			odb.Store(function);
			odb.Close();
			odb = Open("big-data.neodatis");
			NeoDatis.Odb.Test.VO.Login.Function f2 = (NeoDatis.Odb.Test.VO.Login.Function)odb
				.GetObjects(typeof(NeoDatis.Odb.Test.VO.Login.Function)).GetFirst();
			AssertEquals(30000, f2.GetName().Length);
			odb.Close();
			odb = Open("big-data.neodatis");
			f2 = (NeoDatis.Odb.Test.VO.Login.Function)odb.GetObjects(typeof(NeoDatis.Odb.Test.VO.Login.Function
				)).GetFirst();
			f2.SetName(f2.GetName() + "ola chico");
			int newSize = f2.GetName().Length;
			odb.Store(f2);
			odb.Close();
			odb = Open("big-data.neodatis");
			f2 = (NeoDatis.Odb.Test.VO.Login.Function)odb.GetObjects(typeof(NeoDatis.Odb.Test.VO.Login.Function
				)).GetFirst();
			AssertEquals(newSize, f2.GetName().Length);
			AssertEquals(buffer.ToString() + "ola chico", f2.GetName());
			odb.Close();
		}
开发者ID:ekicyou,项目名称:pasta,代码行数:32,代码来源:TestBigData.cs

示例5: GetSelectModel

        public SelectModel GetSelectModel(int pageIndex, int pageSize, string orderStr, string typeName, int status)
        {
            NFMT.Common.SelectModel select = new NFMT.Common.SelectModel();

            select.PageIndex = pageIndex;
            select.PageSize = pageSize;
            if (string.IsNullOrEmpty(orderStr))
                select.OrderStr = "SmsTypeId asc";
            else
                select.OrderStr = orderStr;

            int statusId = (int)Common.StatusTypeEnum.通用状态;

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append(" SmsTypeId,TypeName,ListUrl,ViewUrl,SmsTypeStatus,bd.StatusName ");
            select.ColumnName = sb.ToString();

            sb.Clear();
            sb.Append(" dbo.Sm_SmsType st  ");
            sb.AppendFormat(" left join NFMT_Basic.dbo.BDStatusDetail bd on st.SmsTypeStatus = bd.DetailId and bd.StatusId = {0} ", statusId);
            select.TableName = sb.ToString();

            sb.Clear();
            sb.Append(" 1=1 ");
            if (!string.IsNullOrEmpty(typeName))
                sb.AppendFormat(" and TypeName like '%{0}%' ", typeName);
            if (status > 0)
                sb.AppendFormat(" and SmsTypeStatus = {0} ", status);
            select.WhereStr = sb.ToString();

            return select;
        }
开发者ID:weiliji,项目名称:NFMT,代码行数:32,代码来源:SmsTypeBLL.cs

示例6: Generate

        public static string Generate(string type)
        {
            // TODO: Handle collissions?
            string newuid;

            var sb = new System.Text.StringBuilder();

            // Type
            sb.Append(type);
            sb.Append("$");

            // Server
            sb.Append(Util.ShortHash(Environment.MachineName.ToLower(), machinechars));

            // Rand
            for (var i = 0; i < randchars; i++) sb.Append(randpool[Util.Rand.Next(0, randpool.Length)]);

            // Hash
            sb.Append(Util.ShortHash(sb.ToString(), hashchars));

            // Convert to string
            newuid = sb.ToString();

            return newuid;
        }
开发者ID:invertedtomato,项目名称:Amos2,代码行数:25,代码来源:Uids.cs

示例7: ToHTML

 public override string ToHTML()
 {
     System.Text.StringBuilder sb = new System.Text.StringBuilder();
     foreach (Node n in this)
         sb.Append(n.ToHTML());
     if (this.Arguments.Count == 0)
     {
         // basic IMG only
         return "<img src=\"" + sb.ToString() + "\" alt=\"" + sb.ToString() + "\" />";
     }
     else if (this.Arguments.Count == 1)
     {
         string[] dimensions = this.Arguments[0].Item1.Split('x');
         return "<img src=\"" + sb.ToString() + "\" width=\"" + dimensions[0] + "\" height=\"" + dimensions[1] + "\" />";
     }
     else
     {
         string ret = "<img src=\"" + sb.ToString() + "\" ";
         foreach (Tuple<string, string> arg in Arguments)
         {
             if (arg.Item1.ToLower().Trim() == "width")
                 ret += "width=" + arg.Item2 + " ";
             else if (arg.Item1.ToLower().Trim() == "height")
                 ret += "height=" + arg.Item2 + " ";
         }
         return ret + " />";
     }
 }
开发者ID:mlnlover11,项目名称:BBCodes,代码行数:28,代码来源:ImageNode.cs

示例8: Join

        public static string Join(this string sep, IEnumerable<string> tokens)
        {
            int num_tokens = tokens.Count();
            int num_seps = num_tokens >= 1 ? num_tokens - 1 : 0;

            int total_length = tokens.Select(t => t.Length).Sum() + (num_seps * sep.Length);

            var sb = new System.Text.StringBuilder(total_length);
            int token_index = 0;
            foreach (var token in tokens)
            {
                if (token_index > 0)
                {
                    sb.Append(sep);
                }
                sb.Append(token);
                token_index++;
            }

            string s = sb.ToString();
            if (s.Length != total_length)
            {
                throw new System.InvalidOperationException("Incorrectly calculated length");
            }
            return sb.ToString();
        }
开发者ID:saveenr,项目名称:saveenr,代码行数:26,代码来源:TextUtil.cs

示例9: GetSelectModel

        public Common.SelectModel GetSelectModel(int pageIndex, int pageSize, string orderStr,int priceConfirmId)
        {
            NFMT.Common.SelectModel select = new NFMT.Common.SelectModel();

            select.PageIndex = pageIndex;
            select.PageSize = pageSize;
            if (string.IsNullOrEmpty(orderStr))
                select.OrderStr = "detail.DetailId desc";
            else
                select.OrderStr = orderStr;

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append("detail.DetailId,detail.PriceConfirmId,detail.InterestStartDate,detail.InterestEndDate,CONVERT(varchar,detail.InterestDay) + '天' as InterestDayName,detail.InterestDay,detail.InterestUnit,CONVERT(varchar,detail.InterestUnit)+mu.MUName as InterestUnitName");
            select.ColumnName = sb.ToString();

            sb.Clear();
            sb.Append(" dbo.Pri_PriceConfirmDetail detail ");
            sb.Append(" left join dbo.Pri_PriceConfirm pc on detail.PriceConfirmId = pc.PriceConfirmId ");
            sb.Append(" left join dbo.Con_Contract con on pc.ContractId = con.ContractId ");
            sb.Append(" left join NFMT_Basic..MeasureUnit mu on con.UnitId = mu.MUId ");
            select.TableName = sb.ToString();

            sb.Clear();
            sb.AppendFormat(" detail.PriceConfirmId = {0} and detail.DetailStatus = {1} ", priceConfirmId, (int)Common.StatusEnum.已生效);
            select.WhereStr = sb.ToString();

            return select;
        }
开发者ID:weiliji,项目名称:NFMT,代码行数:28,代码来源:PriceConfirmDetailBLL.cs

示例10: Page_Init

        protected void Page_Init(object sender, EventArgs e)
        {
            if (Request.QueryString.HasKeys() && Request.QueryString["method"] != null)
            {
                System.Web.Script.Serialization.JavaScriptSerializer json = new System.Web.Script.Serialization.JavaScriptSerializer();
                System.Text.StringBuilder text = new System.Text.StringBuilder();
                                switch (Request.QueryString["method"].ToLower())
                {
                    case "getvkl":
                        string name = Request.QueryString["name"], type = Request.QueryString["type"], jvar = Request.QueryString["jvar"], callVkm = Request.QueryString["callVkm"];
                        if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(type))
                            break;

                        json.Serialize(GetVKL(name, type), text);
                        if (string.IsNullOrEmpty(callVkm))
                        {
                            jvar = (string.IsNullOrEmpty(jvar) ? "vkl" : jvar);
                            Response.Write("var " + jvar + "=" + text.ToString());
                        }
                        else
                        {
                            Response.Write("(function() { var vkl=" + text.ToString() + ";VKM.loaded(vkl,\"" + name + "\",\"" + type + "\");})()");
                        }
                        break;

                }
                            }
                        Response.End();
        }
开发者ID:varunkho,项目名称:Akshar,代码行数:29,代码来源:service.aspx.cs

示例11: Summary

 public void Summary(Exception ex, string ExtraInfo = null)
 {
     System.Text.StringBuilder message = new System.Text.StringBuilder();
     if (ExtraInfo != null) message.AppendLine(ExtraInfo + Environment.NewLine);
     message.AppendLine(ex.Description() + Environment.NewLine);
     if (this.Log != null) this.Log.Out(message.ToString(), Dumpster2.Logger.TextFormat.Box);
     var df = new frmError(ex.GetType().Name, message.ToString());
 }
开发者ID:RyogaMasaki,项目名称:dumpster,代码行数:8,代码来源:ex.cs

示例12: ComprobantesGridView_RowCommand

        protected void ComprobantesGridView_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            FeaEntidades.InterFacturas.lote_comprobantes lote = new FeaEntidades.InterFacturas.lote_comprobantes();
            System.Xml.Serialization.XmlSerializer x;
            int item = Convert.ToInt32(e.CommandArgument);
            List<Entidades.Comprobante> lista = (List<Entidades.Comprobante>)ViewState["Comprobantes"];
            Entidades.Comprobante comprobante = lista[item];
            switch (e.CommandName)
            {
                case "Seleccionar":
                    Session["ComprobanteATratar"] = new Entidades.ComprobanteATratar(Entidades.Enum.TratamientoComprobante.Consulta, comprobante);
                    string script = "window.open('/ComprobanteConsulta.aspx', '');";
                    ScriptManager.RegisterStartupScript(this, typeof(Page), "popup", script, true);
                    break;
                case "XML":
                    ////Generar Lote
                    //lote = GenerarLote(false);

                    ////Grabar en base de datos
                    //RN.Comprobante c = new RN.Comprobante();
                    //lote.cabecera_lote.DestinoComprobante = "ITF";
                    //lote.comprobante[0].cabecera.informacion_comprobante.Observacion = "";
                    //c.Registrar(lote, null, "ITF", ((Entidades.Sesion)Session["Sesion"]));

                    x = new System.Xml.Serialization.XmlSerializer(lote.GetType());
                    System.Text.StringBuilder sb = new System.Text.StringBuilder();
                    sb.Append(comprobante.Cuit);
                    sb.Append("-");
                    sb.Append(comprobante.NroPuntoVta.ToString("0000"));
                    sb.Append("-");
                    sb.Append(comprobante.TipoComprobante.Id.ToString("00"));
                    sb.Append("-");
                    sb.Append(comprobante.Nro.ToString("00000000"));
                    sb.Append(".xml");

                    //System.IO.MemoryStream m = new System.IO.MemoryStream();
                    //System.IO.StreamWriter sw = new System.IO.StreamWriter(m);
                    //sw.Flush();
                    //System.Xml.XmlWriter writerdememoria = new System.Xml.XmlTextWriter(m, System.Text.Encoding.GetEncoding("ISO-8859-1"));

                    System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
                    xmlDoc.LoadXml(comprobante.Request);
                    xmlDoc.Save(Server.MapPath(@"~/Temp/" + sb.ToString()));

                    //x.Serialize(writerdememoria, xmlDoc);
                    //m.Seek(0, System.IO.SeekOrigin.Begin);

                    //Descarga directa del XML
                    //System.IO.FileStream fs = new System.IO.FileStream(Server.MapPath(@"~/Temp/" + sb.ToString()), System.IO.FileMode.Create);
                    //m.WriteTo(fs);
                    //fs.Close();
                    Server.Transfer("~/DescargaTemporarios.aspx?archivo=" + sb.ToString(), false);
                    break;
                default:
                    break;
            }
        }
开发者ID:pjeconde,项目名称:CedServicios,代码行数:57,代码来源:ExploradorComprobanteGlobal.aspx.cs

示例13: EscapeDataEncodeTestRfc2396

 public void EscapeDataEncodeTestRfc2396(string input, bool spaceAsPlus, string result)
 {
     System.Text.StringBuilder builder = new System.Text.StringBuilder(input.Length + 20);
     UrlHelper.EscapeEncodingFlag encodingFlags = UrlHelper.EscapeEncodingFlag.LowerCaseHex | UrlHelper.EscapeEncodingFlag.LegacyRfc2396 | UrlHelper.EscapeEncodingFlag.UriString;
     if (spaceAsPlus)
         encodingFlags |= UrlHelper.EscapeEncodingFlag.SpaceAsPlus;
     UrlHelper.EscapeDataEncode(input, builder, encodingFlags);
     Assert.Equal(result, builder.ToString());
     Assert.Equal(input.Replace('+', ' '), DecodeUrlString(builder.ToString()));
 }
开发者ID:NLog,项目名称:NLog,代码行数:10,代码来源:UrlHelperTests.cs

示例14: Extended

 public void Extended(Exception ex, string ExtraInfo = null)
 {
     System.Text.StringBuilder message = new System.Text.StringBuilder();
     if (ExtraInfo != null) message.AppendLine(ExtraInfo + Environment.NewLine);
     message.AppendLine(ex.Description() + Environment.NewLine);
     message.AppendLine("--Stack Trace--" + Environment.NewLine + ex.StackTrace + Environment.NewLine);
     if (ex.InnerException != null) message.AppendLine("Inner Exceptions:" + Environment.NewLine + ex.InnerExList() + Environment.NewLine);
     if (this.Log != null) this.Log.Out(message.ToString(), Dumpster2.Logger.TextFormat.Box);
     var df = new frmError(ex.GetType().Name, message.ToString());
 }
开发者ID:RyogaMasaki,项目名称:dumpster,代码行数:10,代码来源:ex.cs

示例15: ToHTML

        public override string ToHTML()
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            foreach (Node n in this)
                sb.Append(n.ToHTML());

            if (Arguments.Count != 0)
                return "<blockquote cite=\"" + Arguments[0].Item1 + "\">" + sb.ToString() + "</blockquote>";
            else
                return "<blockquote>" + sb.ToString() + "</blockquote>";
        }
开发者ID:mlnlover11,项目名称:BBCodes,代码行数:11,代码来源:QuoteNode.cs


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