If I'm getting this correctly, given a set of arguments, you put | after each param.
After this you remove one or more original params from the string in order to get the keys.
The keys then have to be returned in an array/vector.
Firstly, do you need to have two separate params (a&b) in the first example? If you have an array, will that suffice?
Once you have an input array, the steps may become a lot clearer.
Jacob Sonia wrote:I want to create keys with different combinations.
Let's say i have two params(a, b), then the keys would be like this:
That looks a lot like
If i have 3 params(a,b,c), then the keys would be like this:
And that looks a lot like
That's a HUGE hint, by the way.
Joined: Jun 28, 2009
My concern is that i could have anything in a like 23 and in b like 12333. I want to pass a key already made like this 12|123|123| and when for a and b(the combinations i am looking for), i want the program to append it and create combinations like this:
How is this possible, i am not able to think through it fully.
I don't understand what you are trying to do exactly. you have an existing key, like 12|123|123|. Now you are saying you are adding two new fields/pieces, like 'a' and 'b'?
so you will pass a string in, and return an array of strings. Your method will use Jeff's HUGE HINT to generate all the possible things you want to add on. Then you can create a bunch of new Strings by concatenating the passed in string with all the new ones you create.
or have we completely misunderstood what you are trying to do?
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Joined: Jun 28, 2009
yes i will pass a string to a method and let's say two more params
I'll re-iterate what I said before. There are two pieces. your method needs to build all the possible pieces that can be added on, like this:
and then, for each one, it needs to append it onto the end of 'input'.
Note that you probably don't want a method signature of "inputString(String input, String param1, String param2) ". If you did it that way, you'd need a new method every time you wanted to add another param...
Generic questions like "I need help" or "show me how to do this project" are generally met with silence. Right now, it looks like you have put zero effort into doing this. If you have put in zero effort, why do you expect anyone else to put in any more effort?
You've been given several suggestions throughout this thread, and only come back with "yeah, I need help writing this code".
My first suggestion would be to try writing SOMETHING...ANYTHING...to at least get started.