Hi
In so many time, we will get requirement to split the sentence into words. We can split the sentence on basis of space like this.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;public partial class Program_Spliting_of_Text : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{}
protected void Button1_Click(object sender, EventArgs e)
{
string str = TextBox1.Text;
//split the string o basis of ‘ ‘ (space)
string[] words= str.Split(‘ ‘);
foreach (string s in words)
{
Label1.Text += s + "<br/>";
}
}
}