tsteward Well-Known Member Licensed User Longtime User Feb 6, 2015 #1 I have a string dim mystring(someqty) as string Length of mystring is variable and may look like this mystring(0) = 24311 mystring(1) = 327-- Each item will be the same length but length may vary each run. string(0) will always contain full set of characters following string my contain '-' which is to be ignored. Now I want to build a list of all possible permutations without mixing columns. result: 24311 24711 22311 22711 34311 34711 32311 32711 I know I can do this but just cant get my head around it Any help appreciated.
I have a string dim mystring(someqty) as string Length of mystring is variable and may look like this mystring(0) = 24311 mystring(1) = 327-- Each item will be the same length but length may vary each run. string(0) will always contain full set of characters following string my contain '-' which is to be ignored. Now I want to build a list of all possible permutations without mixing columns. result: 24311 24711 22311 22711 34311 34711 32311 32711 I know I can do this but just cant get my head around it Any help appreciated.
Peter Simpson Expert Licensed User Longtime User Feb 6, 2015 #2 I've probably got your question completely wrong but... Code: 'Hmm... Dim Counter() As String = Array As String(1, 2, 3, 4, 5, 6, 7, 8, 9, 0) For i = 0 To Counter.Length - 1 Log(Counter(i)) Next You can also use Regex.Split("-", i) Last edited: Feb 6, 2015 Upvote 0
I've probably got your question completely wrong but... Code: 'Hmm... Dim Counter() As String = Array As String(1, 2, 3, 4, 5, 6, 7, 8, 9, 0) For i = 0 To Counter.Length - 1 Log(Counter(i)) Next You can also use Regex.Split("-", i)
T Troberg Well-Known Member Licensed User Longtime User Feb 6, 2015 #3 You'll probably have to do it recursively, first creating all options for the first digit, then for each of them, all possible options for the second digit and so on. Be aware, though, that the number of possible permutations will escalate very quickly. Assuming no "-" in the numbers, it's be something along the lines of NumberOfItems^LengthOfItems. In other words, chances are that the stack will burst like something that bursts violently. None of this removes duplicates, by the way... Upvote 0
You'll probably have to do it recursively, first creating all options for the first digit, then for each of them, all possible options for the second digit and so on. Be aware, though, that the number of possible permutations will escalate very quickly. Assuming no "-" in the numbers, it's be something along the lines of NumberOfItems^LengthOfItems. In other words, chances are that the stack will burst like something that bursts violently. None of this removes duplicates, by the way...