C# Trim去掉指定字符,例如去掉零。

 
private void button1_Click(object sender, EventArgs e)
{
  this.textBox2.Text = this.textBox1.Text.Trim('0');
  this.textBox3.Text = this.textBox1.Text.TrimStart('0');
  this.textBox4.Text = this.textBox1.Text.TrimEnd('0');
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章