Hello everyone, Here I am going to write a Program to find all substrings from a String. This example code iterate through all possible lengths of a substring.
C# Program to find all substrings from a String
Here is the source code to find all substrings from a String.
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Program { static void Main(string[] args) { Console.WriteLine("Enter a String"); string sInput = Console.ReadLine(); ; // Avoid full length. for (int length = 1; length < sInput.Length; length++) { // End index is tricky. for (int start = 0; start <= sInput.Length - length; start++) { string sSubString = sInput.Substring(start, length); Console.WriteLine(sSubString); } } Console.ReadKey(); } }
Output:
View More:
- C# Program to read text File line by line.
- C# Program to Print Pyramid Pattern in C#.
- C# Program to Print Fibonacci Series.
- C# Program to find the sum of all item of an Integer Array.
Conclusion:
I hope you loved this post. Please don’t hesitate to comment for any technical help. Your feedback and suggestions are welcome to me.
Thank You.
best drugstore eyeshadow pharmacy rx dysfunction
pharmacy rx california pharmacy ed meds
usa pharmacy wall drug store pharmacy rx world
ed treatment pharmacy prices erectile dysfunction drug
the pharmacy erection pills specialty pharmacy
ed pills online pharmacy open near me mexican pharmacy online
canadian pharmacy viagra pharmacy rx ed medication
best drugstore shampoo erectile dysfunction causes canadian pharmacies
You made some decent points there. I seemed on the internet for the issue and located most individuals will go together with along with your website.
Hey there, I think your website might be having browser compatibility issues. When I look at your blog site in Chrome, it looks fine but when opening in Internet Explorer, it has some overlapping. I just wanted to give you a quick heads up! Other then that, fantastic blog!
It’s very trouble-free to find out any topic on web as compared to textbooks, as I found this paragraph at this website.|