Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

source code

$
0
0

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());
                     
                }
            }

Viewing all articles
Browse latest Browse all 12583

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>