I have a String = " my name is anurag..." i want to break this string into "int length=10" 10 characters and Check that NO Blank space after 5 character and No half word is Print,if any half word come Example "anu" then it will print the whole "anurag" in next line suggest me the function.
public void stringsplitter(string itemline , int limit=10){
try
{
itemline = "My Name is Anurag currently i am working with xyz abc pvt Ltd";
int start = 0, end = limit;
int scale = itemline.Length;
int part = scale / limit;
StringBuilder sb = new StringBuilder();
for(int i=0;i<part;i++)
{
string sub=itemline.Substring(start,end);
sb.Append(sub);
//String result = sb.ToString();
MessageBox.Show(sb.ToString());
}
}