
-----------------------------------
Amailer
Thu Aug 03, 2006 11:03 am

Generating all possible combinations
-----------------------------------
Hey,
Can anyone explain to me a way to create a function that allows me to get every single combination of case and numbers represneting letters of a word?

Example, I enter the word 'hello' (all lower case) into the function, it should output:
Hello
HEllo
HELlo
HELLo
HELLO
Hell0
HEll0
HELl0
HELL0
hEllo
heLlo
helLo
hellO

and so on xD

-----------------------------------
[Gandalf]
Thu Aug 03, 2006 1:15 pm


-----------------------------------
I don't know... But I can't think of any reason for doing this that can't be solved by using a changeToUpperCase(word) function.  If not, I'd like to hear what your reason is. :)

-----------------------------------
Tony
Thu Aug 03, 2006 3:20 pm


-----------------------------------
have a function that takes in a character, and returns an array of alternatives


fnc leet(char a)
{
     if (a == 'o')
         return ['o', 'O', 0];
}

Then run though the length of the string recursivly

-----------------------------------
bugzpodder
Thu Sep 07, 2006 8:15 pm


-----------------------------------
this is a terrible mix of C,C++, and PHP, and pseudocode

function f(string x) {
   for each variation of x[0]
     echo x[0].f(x.substr(1));
}

-----------------------------------
Decadence666
Tue Oct 24, 2006 9:40 pm


-----------------------------------
ok, heres a tip to help you. 

$var = "Hello"

$var{1} is equal to 'H'

I belive, i don't have access to my files right now but i think thats how you access a single char in a string.

-----------------------------------
Craige
Tue Oct 24, 2006 10:01 pm


-----------------------------------
I'm sure if I thought about it for a while, I could write a function to do it, but if I may ask: why would you want something to do this?

-----------------------------------
rdrake
Tue Oct 24, 2006 10:34 pm


-----------------------------------
I'm sure if I thought about it for a while, I could write a function to do it, but if I may ask: why would you want something to do this?A thought would be something like an offensive words filter.

-----------------------------------
md
Tue Oct 24, 2006 10:42 pm


-----------------------------------
I'm sure if I thought about it for a while, I could write a function to do it, but if I may ask: why would you want something to do this?A thought would be something like an offensive words filter.
There are easier solutions to that; such as making each word lowercase and comparing to a loercase lsit of offensive words. This sounds like either homework or just fooling around learning the language.

-----------------------------------
Craige
Wed Oct 25, 2006 7:19 am


-----------------------------------
There are easier solutions to that; such as making each word lowercase and comparing to a loercase lsit of offensive words. This sounds like either homework or just fooling around learning the language.

Indeed, but it would be something interesting to code.
