Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR 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;
}
 
PREVIOUS NEXT
Tagged: #substrings #string
ADD COMMENT
Topic
Name
1+9 =