c# - Find all combinations in a string separated -
i'm trying combinations in string in c# idea in mind: given string foo want list<string> values: f o o fo o foo f oo as can see it's not easy substring chars in string separated spaces. i've tried doing like: list<string> result = new list<string>(); string text = "foo"; (int = 1; < foo.lenght; i++) { //i'm stucked --> think stupid , don't know how procede or not fast enough. i'm stuck. } edit: there correct answers it's clear of them won't since strings working have between 55 , 85 chars each 1 means best function in answers give me between 2^54 , 2^84 possible combinations , bit much. it clear find combinations , afterwards them won't do. i'll have drop it. first things first: if string length n , 2^n strings output. so, if want treat strings of length 70, have problem. you can use counter, enumerating 0 2^n , , treat bitwise mask: if first bit 1, put space between first ,