c# 字符串处理

 1 private void button1_Click(object sender, EventArgs e)   
 2  {   
 3      this.textBox1.Text = "10005";   
 4  }   
 5 //给字符串加.   
 6  private void Form1_Load(object sender, EventArgs e)   
 7  {   
 8      this.textBox1.Text = "10005";   
 9      string a = textBox1.Text;   
10      string var1 = "";             
11      for (int i = 0; i < a.Length; i++)   
12      {                               
13         var1 += String.Format(a[i] + "{0}", i < a.Length - 1 ? "." : "");     
14      }   
15      this.textBox1.Text = var1;   
16  } 
17   
18 输出格式1.0.0.0.5

 

posted @ 2018-08-13 17:52  往事随风_go  阅读(101)  评论(0编辑  收藏  举报