Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

all possible substrings of a string

public static  List<string> AllSubString(string str)
{
  var list = new List<string>();
  for (int i = 0; i < str.Length; i++)
  {
    for (int j = i; j <= str.Length; j++)
    {
      var sub = str.Substring(i, str.Length-i);
      list.Add(sub);
    }
  }
  return list;
}
Comment

All Substring of String

public static List<string> SubString(String str)
{
  var list = new List<string>();
  for (int i = 0; i < str.Length; i++)
  {
    for (int j = 1; j <= str.Length - i; j++)
    {
      list.Add(str.Substring(i, j));
    }
  }
  return list;
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: Entity Framework Core 3.1 Return value (int) from stored procedure 
Csharp :: calling stored procedure in c# entity framework 
Csharp :: C# loop through array of objet 
Csharp :: get property value from object c# 
Csharp :: dotnet automapper.extensions.microsoft.dependencyinjection 
Csharp :: unity no serializefield 
Csharp :: NameValueCollection 
Csharp :: c# radio button checked 
Csharp :: c# readline char 
Csharp :: how c# connection 
Csharp :: c# string enum 
Csharp :: on collision enter by layer 2d unity 
Csharp :: update listbox using class c# 
Csharp :: c# list foreach 
Csharp :: how to show an arrya in c# 
Csharp :: unity keep screen always on 
Csharp :: c# today without time 
Csharp :: remove multiple items from list c# 
Csharp :: c# csvhelper 
Csharp :: c# streamwriter add new line 
Csharp :: how to create a variable in c# 
Csharp :: how to get file type from base64 in c# 
Csharp :: How to post request C# with returning responsebody 
Csharp :: all Substring of String 
Csharp :: convert number of days into months c# 
Csharp :: c# get logged on user name 
Csharp :: unity model ripper 
Csharp :: c# loop array 
Csharp :: deploy .net core 
Csharp :: Unity rainbow color changing object 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =