Hi, I have this question:
Delete the blank spaces of a string that is entered by keyboard. The result it must be in another chain. You can not use replace methods.
Hi, I have this question:
Delete the blank spaces of a string that is entered by keyboard. The result it must be in another chain. You can not use replace methods.
You must use a for
loop, create a new string and concatenate character by character in that new string (you must first initialize it eg result = ""
.) Then check each character with a cadenaoriginal.charAt(i) [i=contador del bucle for])
, if the character is equal to a blank space, omit and go to the next string, if it is not equal to space then concatenates the character to the resulting new string.