本文整理汇总了C#中System.Text.StringBuilder.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# System.Text.StringBuilder.Remove方法的具体用法?C# System.Text.StringBuilder.Remove怎么用?C# System.Text.StringBuilder.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Text.StringBuilder
的用法示例。
在下文中一共展示了System.Text.StringBuilder.Remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FreeFriendship
public string FreeFriendship()
{
System.Text.StringBuilder sbResult = new System.Text.StringBuilder();
try
{
long oringnateId = default(long);
long destinationId = default(long);
int direction = default(int);
/************** Input *****************/
if (CY.Utility.Common.RequestUtility.IsGet)
{
oringnateId = CY.Utility.Common.RequestUtility.GetQueryLong("accountId", default(long));
destinationId = CY.Utility.Common.RequestUtility.GetQueryLong("friendId", default(long));
direction = CY.Utility.Common.RequestUtility.GetQueryInt("direction", default(int));
}
else if (CY.Utility.Common.RequestUtility.IsPost)
{
oringnateId = CY.Utility.Common.RequestUtility.GetFormLong("accountId", default(long));
destinationId = CY.Utility.Common.RequestUtility.GetFormLong("friendId", default(long));
direction = CY.Utility.Common.RequestUtility.GetFormInt("direction", default(int));
}
/***********Input Validation **********/
if (direction == default(int))
{
direction = 1;
}
if (oringnateId <= default(long) || destinationId <= default(long))
{
throw new Exception("解除朋友关系的起始ID和结束ID二者都不能小于Default(long)");
}
/************ Action ***************/
CY.UME.Core.Business.Account currentAccount = CY.UME.Core.Business.Account.Load(oringnateId);
CY.UME.Core.Business.Account friendAccount = CY.UME.Core.Business.Account.Load(destinationId);
if (currentAccount == null || friendAccount == null)
{
return String.Empty;
}
currentAccount.DeleteFriend(friendAccount);
}
catch
{
sbResult.Remove(0, sbResult.Length).Append(string.Format("{success:false,status:'none',action:'none',msg:'{0}'}", "系统异常")).ToString();
}
return sbResult.Remove(0, sbResult.Length).Append("{success:true,status:'update',action:'update',msg:'success'}").ToString();
}
示例2: GetDocumentsNames
private string GetDocumentsNames()
{
System.Text.StringBuilder names = new System.Text.StringBuilder();
foreach (var doc in this.DeliveryDocumentation_Documents)
names.AppendFormat("{0}, ", doc.Documents.DOCS_Desc);
return names.Remove(names.Length - 2, 2).ToString();
}
示例3: GetOrdersNames
private string GetOrdersNames()
{
System.Text.StringBuilder names = new System.Text.StringBuilder();
foreach (var order in this.DeliveryDocumentation_Orders)
names.AppendFormat("{0}, ", order.Orders.ORDR_Code);
return names.Remove(names.Length - 2, 2).ToString();
}
示例4: GetModsFromEnum
public string GetModsFromEnum(int modsEnum, bool shortMod = false)
{
System.Text.StringBuilder modStr = new System.Text.StringBuilder();
for (int i = 0; i < _modsEnumVals.Length; i++)
{
if ((modsEnum & _modsEnumVals[i]) > 0)
{
modStr.Append(shortMod ? _modsShort[i] : _modsLong[i]);
modStr.Append(",");
}
}
string retVal;
if (modStr.Length > 1)
{
modStr.Remove(modStr.Length - 1, 1);
retVal = modStr.ToString();
if (retVal.Contains("NC"))
{
retVal = retVal.Replace("DT,", "");
}
}
else
retVal = modStr.Append(shortMod ? _modsShort[0] : _modsLong[0]).ToString();
return retVal;
}
示例5: GetInsertCommand
public static string GetInsertCommand(System.Data.DataTable dt)
{
string retVal = null; ;
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("INSERT INTO ");
sb.Append(dt.TableName);
sb.Append(" \r\n( \r\n ");
foreach (System.Data.DataColumn dc in dt.Columns)
{
sb.Append(dc.ColumnName);
sb.Append(" ");
sb.Append(System.Environment.NewLine);
sb.Append(" ,");
}
sb.Remove(sb.Length - 8, 8);
sb.Append(" ");
sb.Append(System.Environment.NewLine);
sb.Append(") \r\n");
sb.Append("VALUES \r\n( \r\n ");
foreach (System.Data.DataColumn dc in dt.Columns)
{
sb.Append("@");
sb.Append(dc.ColumnName);
sb.Append(" ");
sb.Append(System.Environment.NewLine);
sb.Append(" ,");
}
sb.Remove(sb.Length - 8, 8);
sb.Append(" ");
sb.Append(System.Environment.NewLine);
sb.Append(");");
retVal = sb.ToString();
// System.Console.WriteLine(retVal);
sb.Length = 0;
sb = null;
return retVal;
}
示例6: CreateQueryStringFromParameters
private static string CreateQueryStringFromParameters(Dictionary<string,string> queryParams)
{
System.Text.StringBuilder queryString = new System.Text.StringBuilder();
foreach (string key in queryParams.Keys)
queryString.Append("&" + key + "=" + queryParams[key]);
queryString.Remove(0, 1); //removing the first '&'
return queryString.ToString();
}
示例7: ProcessRequest
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "application/json";
string valUnid = context.Request.Params["Unid"];
if (valUnid != "0" || valUnid == "undefined")
{
int unid = CY.Utility.Common.ConvertUtility.ConvertToInt(valUnid, -1);
if (unid == -1)
{
context.Response.Write("{success:false,msg:'参数错误'}");
return;
}
try
{
IList<College> collegeList = College.GetCollegeByUniIdAndName(unid, "");
if (collegeList.Count >= 1)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("{success:true,college:[");
//ID,Name,UniversityID,Des,DateCreated
foreach (College college in collegeList)
{
sb.Append("{ID:'");
sb.Append(college.Id);
sb.Append("',Name:'");
sb.Append(college.Name);
sb.Append("'},");
}
sb.Remove(sb.Length - 1, 1);
sb.Append("]}");
context.Response.Write(sb.ToString());
}
else
{
context.Response.Write("{success:false,msg:'没有学院'}");
}
}
catch (Exception ex)
{
context.Response.Write("{success:false,msg:'" + ex.Message + "'}");
}
}
else
{
context.Response.Write("{success:false,msg:'参数错误'}");
return;
}
}
示例8: ToString
public override string ToString()
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append(Column);
sb.Append(" IN (");
foreach (ISQLExpression e in SubQueries)
sb.Append(e).Append(", ");
sb.Remove(sb.Length - 2, 2);
sb.Append(")");
return sb.ToString();
}
示例9: InitializationKitsList
internal static string InitializationKitsList()
{
System.Text.StringBuilder kits = new System.Text.StringBuilder ();
foreach (Settings.InstalledKit kit in Settings.Instance.InstalledKits) {
kits.Append (CommonBuild.FabricCommonBuild.MakeKitNameAndInitMethod (kit.Name));
kits.Append (',');
}
// Remove the trailing comma
return kits.Remove (kits.Length - 1, 1).ToString ();
}
示例10: ConvertToString
/// <summary>
/// Converts an integer to a string representation
/// </summary>
/// <param name="value">The integer to convert to string</param>
/// <returns></returns>
private string ConvertToString( int value )
{
int count = value / 10 + 1;
if ( count > 3 )
return value.ToString();
System.Text.StringBuilder sb = new System.Text.StringBuilder( "0000", 4 );
sb.Remove( 0, count );
sb.Append( value );
return sb.ToString();
}
示例11: CollectionToString
public static string CollectionToString(System.Collections.ICollection set_Renamed, string sep)
{
var buffer = new System.Text.StringBuilder();
System.Collections.IEnumerator iter = set_Renamed.GetEnumerator();
buffer.Append("{");
while (iter.MoveNext())
{
buffer.Append(iter.Current).Append(sep);
}
buffer.Remove(buffer.Length - sep.Length, 1);
buffer.Append("}");
return buffer.ToString();
}
示例12: getProvince
protected string getProvince()
{
var province = from o in db.Province where o.CountryID == 1 orderby o.ProvinceCode select o;
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("[");
foreach (var item in province)
{
sb.Append("{");
sb.Append("\"ProvinceID\":\"" + item.ProvinceID + "\",\"ProvinceName\":\"" + item.ProvinceName + "\"");
sb.Append("},");
}
sb.Remove(sb.Length - 1, 1);
sb.Append("]");
return sb.ToString();
}
示例13: GetAuthorByBookID
public string GetAuthorByBookID(int bookID)
{
var kk = (from p in db.TakePartIns
from q in db.Authors
where p.AuthorId == q.AuthorId && p.BookId == bookID
select new { q.AuthorName }).ToList();
System.Text.StringBuilder str =new System.Text.StringBuilder();
foreach (var item in kk)
{
str.Append(item.AuthorName.ToString());
str.Append(", ");
}
if(str.Length>2)str.Remove(str.Length - 2, 2);
return str.ToString();
}
示例14: getcityZone
protected string getcityZone()
{
int cityID = int.Parse(Request["cityID"]);
var cityZone = db.CityZone.Where(o => o.CityID == cityID);
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("[");
foreach (var item in cityZone)
{
sb.Append("{");
sb.Append("\"cityZoneID\":\"" + item.CityZoneID + "\",\"cityZoneName\":\"" + item.CityZoneName + "\"");
sb.Append("},");
}
sb.Remove(sb.Length - 1, 1);
sb.Append("]");
return sb.ToString();
}
示例15: bind
private void bind(string accountIds,string Contents, string BeginTime, string EndTime, bool isTrue)
{
CY.UME.Core.PagingInfo pagingInfo = new CY.UME.Core.PagingInfo();
pagingInfo.CurrentPage = AspNetPager1.CurrentPageIndex;
pagingInfo.PageSize = AspNetPager1.PageSize = SetCurrentPageSize.CurrentPageSize;
IList<MiniBlogExtend> miniBlogExtendList = MiniBlogExtend.GetMiniBlogByPagesAndActId("myfirstday", pagingInfo);
if (miniBlogExtendList != null && miniBlogExtendList.Count >= 1)
{
/****** 拼接Id开始 ******/
System.Text.StringBuilder strFilter = new System.Text.StringBuilder();
strFilter.Append("");
foreach (MiniBlogExtend miniBlogExtend in miniBlogExtendList)
{
strFilter.Append(miniBlogExtend.Id + ",");
}
if (strFilter.ToString() != "0")
strFilter.Remove(strFilter.Length - 1, 1);
/****** 拼接Id结束 ******/
IList<CY.UME.Core.Business.MiniBlog> miniBlogList = CY.UME.Core.Business.MiniBlog.GetAllMiniBlogsById(accountIds, strFilter.ToString(),Contents, BeginTime, EndTime, pagingInfo);
if (isTrue)
AspNetPager1.RecordCount = CY.UME.Core.Business.MiniBlog.GetMiniBlogsCount_FirstDay(accountIds, strFilter.ToString(),Contents, BeginTime, EndTime);
AspNetPager1.Visible = true;
Repeater2.Visible = false;
Repeater1.Visible = true;
Repeater1.DataSourceID = "";
Repeater1.DataSource = miniBlogList;
Repeater1.DataBind();
}
else
{
AspNetPager1.Visible = false;
Repeater1.Visible = false;
Repeater2.Visible = true;
Repeater2.DataSourceID = "";
Repeater2.DataSource = BindNoData("暂无数据");
Repeater2.DataBind();
}
}