Hello, How could I delete certain characters in a String, totally deleting it not just replacing it with a space..
Because I need to get the length of the letters only.. The space is always added in the counting of the length :D
Printable View
Hello, How could I delete certain characters in a String, totally deleting it not just replacing it with a space..
Because I need to get the length of the letters only.. The space is always added in the counting of the length :D
Can't you just do someting like:
For more detail you can read it here: String (Java 2 Platform SE 5.0)Code:str = str.replace("X", "");
hmm.. the next cannot be an empty string...
Attachment 3975
ha, it doesnt work if I use a variable... but I need the variable to determine the letter I want to be replaced.
Ok I got it now.. thanks :D
hmm how about changing only one character.. .replace changes all the occurrence of that character in a string.. example "develop" change the first e into something else ... like duvelop
I promise that you will find the necessary method in here: String (Java Platform SE 7 )
can you give me a hint ;)
The method name has replace in it.
And it's not the [hint]first[/hint] method on the list.