Monday, February 27, 2017

How to use C# string Split

using System; using System.Windows.Forms; namespace WindowsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { string str = null; string[] strArr = null; int count = 0; str = "CSharp split test"; char[] splitchar = { ' ' }; strArr = str.Split(splitchar); for (count = 0; count <= strArr.Length - 1; count++) { MessageBox.Show(strArr[count]); } } } }

No comments:

Post a Comment