Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

sorce code

$
0
0

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


Viewing all articles
Browse latest Browse all 18858

Trending Articles



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