You can get the length of all possible substrings of a given string in C# by using nested loops and the Substring
method.
main.cs627 chars27 lines
In this code, we first initialize an array substrLen
to store the lengths of all possible substrings. We then use nested loops to generate all possible substrings of the given string. For each substring, we use the Substring
method to extract it from the original string, and then we get its length and store it in the substrLen
array. Finally, we print the lengths of all substrings by iterating over the array.
gistlibby LogSnag