如何替换最后一个字符 str = str.Substring(0, sqlstr.Length - 1); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 class Program { static void Main(string[] args) { string aa; aa = Console.ReadLine(); aa = aa.Substring(0, aa.Length - 1); Console.WriteLine(aa); } } string str="123,";int size=str.Length;str.Remove(size-1); //删除str.Insert(size-1,'*'); //替换很灵活msdnstring 方法自己多试试,就清晰了 jiatong1981(末日之痕)又快又简单 string S = "Zswang 路过(";S = S.Remove(S.Length - 1, 1).Insert(S.Length - 1, ")"); str = str.Substring(0, sqlstr.LastIndexOf(",")); jiatong1981(末日之痕)又快又简单 str=str.Replace(str.Substring(0,sqlstr.Length-1),","); 请教。。如何在c#中对access查询,插入数据 Application.ThreadException能否输出出现异常的行号? 为什么保存TextBox控件中输入的数据,再次读取时出现乱码呢? 用户状态更新 如何在c#.net中应用ajax Document 对象的字符串如何过滤 线程锁的问题!小问题求解! C#操作Excel,在画好固定格式的Excel表中写入查询出来的数据填充到相应的位置 关于如何构建ORM层问题? 简单的OleDbCommand的问题,请教! TreeView的撤销操作问题? C#的E_mail发送简单实现
{
static void Main(string[] args)
{
string aa;
aa = Console.ReadLine();
aa = aa.Substring(0, aa.Length - 1);
Console.WriteLine(aa);
}
}
int size=str.Length;
str.Remove(size-1); //删除str.Insert(size-1,'*'); //替换很灵活
msdn
string 方法
自己多试试,就清晰了
S = S.Remove(S.Length - 1, 1).Insert(S.Length - 1, ")");