Ok and there's a bit more, if anyone can give me any ideas for it would be great.
ok so i have my string x= "ABCEFGH"
i need to first check if the length is a multiple of 6.
if it is not, i need to add the # character to the end to make it a multiple of 6.
then i need to take the first six, and do the replacements i mentionned above, and then add the number 0 in front of it, since i didn't have to add...
User Profile
Collapse
-
altering characters in a string
Hi, i need to do some character replacements in a string.
heres what i have to do, lets say i have the string x= ABCD
i would have to change the character at index 0 to 1, then at 2 to 4, and so on.
i tried to do x.replace(x.cha rAt(0), x.charAt(1)), but then what happened was if the characters in the string were the same, it replaced all of them by the character at one.
does anyone know how i could do this so this doesn... -
-
making a string out of integers
hey, i need to make an id. the first 3 numbers are 202, the second 2 are randomly generated, and the last one is an integer, which we get from somewhere else. the problem is the final value has to be stored in a long but i cant get the numbers together because the program just adds the integer values, instead of concatenating.
does anyone know how i can do this.
heres an example:
int x= a random number(say 2)... -
I'm just beginning java, i havent learnt anything about string arguments yet, do you know how to do it with loops maybe?...Leave a comment:
-
Switching between strings
Hey, i have to write a program in which we will apply the same code to 5 different strings. The thing is were not allowed to write the code more than once, and our output has to be given for each string. Does anyone know how to do this? -
-
No its actually the exact same thing as the other persons. no arrays allowedLeave a comment:
-
Stick Game
Hi, I am just starting to learn java and i need to make a game.
So there are 2 players in the game. We have 5 rows of sticks arranged so that 1st row has 1 stick, the 2nd has 2 sticks, etc. players take turns and can remove as many sticks as they want, and from which ever row. goal is to remove the last stick.
We need to alternate between both players, print out the game after each turn, and check if the player has won after...
No activity results to display
Show More
Leave a comment: