Generate list of all possible permutations of a string.
list = originalString.split("")
index = (0,0)
list = [""]
for iteration n in 1 to y:
index = (index[1], len(list))
for string s in list.subset(index[0] to end):
for character c in originalString:
list.add(s + c)
Tags: language-agnostic string cross-platform
Source: By UnkwnTech as answer to the question
This code snippet was collected from stackoverflow, and is licensed under CC BY-SA 3.0
Related code-snippets:
- How can I get the value of in a loop?
- Function for creating color wheels.
- Why use unsigned values over signed ones?
- How can I use combinations of sets as test data?
- Format string to title case. Title case is a common text format in English.
- How can we efficiently get sorted sums of a sorted list?
- How can I make my projects international in india?
- In postgresql, string literals are used as escape characters. Is this a good idea for postgresql?
- A little diversion into floating point (im)precision, part 1 | 1 – 0 | 1 | 1 | 1 | 1 | 1 | 1 | 2 | 1 | 1 | 2 | 1 | 2 | 1 | 1 | 2 | 1 | 2 | 3 | 4 | A little diversion into floating point (im)precision, part 1 | 3 | 4 | 5 | 5 | 8 | 8 | 2 | 3 | 4 | 7 | 8 | 7 | 7 | 7 | 6 | 1 | 1 | 5 | 1
- I am using the directx x or opengl to create 100 floating cubes. Is this possible?
- "Sorting" colors by distinctiveness. Followup:
- How can I modify a.xfdl file?
- Which OS am I running on and how can I adapt it?
- Pass by reference or pass by value?
- How can I start using Version Control and Visual Studio?