I have a String = " my name is anurag" i want to break this string into "int length=5" 5 characters and Check that NO Blank space after 5 character and No half word is Print? suggest me the code
public void stringsplitter(string itemline , int limit=20){
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());
}
}