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# add 2 arrays 
Csharp :: c# directory file 
Csharp :: unity convert number to notation 
Csharp :: c# max two values 
Csharp :: wpf clear grid 
Csharp :: switch case with 2 variables c# 
Csharp :: unity detect a touch on ui element 
Csharp :: how to get an arrays length in c# 
Csharp :: datatable iqueryable c# linq 
Csharp :: c# yield keyword 
Csharp :: how to remove all comma from string c# 
Csharp :: which game engine is best 
Csharp :: c# substring until character single 
Csharp :: how to use curl in asp.net c# 
Csharp :: c# loop class properties add to array 
Csharp :: c# how to compare 2 dates without time 
Csharp :: how to display array in string in c# 
Csharp :: c# const vs readonly 
Csharp :: slither io hack 
Csharp :: unity singleton 
Csharp :: where to write fluent api 
Csharp :: euler to quaternion 
Csharp :: Printing pattern in c# 
Csharp :: select range in list c# 
Csharp :: c# get random between 0 and 1 
Csharp :: c# convertir caracter con tilde 
Csharp :: c# open access database mdb 
Csharp :: c# get index of item in list 
Csharp :: unity rigidbody freeze all rotation 
Csharp :: how to check if an integer is in array c# 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =