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 Possible 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 :: c# loop xml 
Csharp :: how to get rid of the slashes in datetime variables c# 
Csharp :: wpf stackpanel 
Csharp :: asp.net core identity get all roles 
Csharp :: c# random number between 0 and 1 
Csharp :: convert number of days into months c# 
Csharp :: mongodb c# batch find 
Csharp :: entity framework core genetare class using existing database 
Csharp :: c# tostring decimal 2 places 
Csharp :: C# actions 
Csharp :: get number of days between two dates c# 
Csharp :: c# remove all items from list where item value is null 
Csharp :: c# check if array contains value 
Csharp :: if list does not contain then add c# 
Csharp :: LINQ: 2 join with group by 
Csharp :: ihttpactionresult to object c# 
Csharp :: compare two strings in c# 
Csharp :: c# list find index 
Csharp :: c# iterate sorteddictionary 
Csharp :: how to have referecne to script in unity 
Csharp :: c# substring reverse 
Csharp :: how to change all values in dictionary c# 
Csharp :: combine two arraylist c# 
Csharp :: c# windows forms cancel event 
Csharp :: unity get audio clip length 
Csharp :: predicate EF Core search query 
Csharp :: C# Calculate MD5 Checksum For A File 
Csharp :: c# Remove String In C# 
Csharp :: top down view movement script 
Csharp :: unity rollaball 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =