Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
to get rid of it
AFAIK : only if there is ONE expression expected to follow, any others beyond that will be considered not part of that statement
I didn't know you could exclude curly brackets on an if statement
This comment is hidden because it contains spoiler information about the solution
Everything can be solved with if.
Could've also used 1 in the place of 0 if im not mistaken...
Thank you.
Such a graceful solution!
I we know the library methods, then why not?
I would rather place an if statement in your for loop to only edit the characters which are alphabetical. do something like if(Character.isAlphabetical(string.getChar(i))) { }. This means the for loop will not do anything with the blank spaces so long as you're adding to the array in the if statement.
Should it have been though?
Java has dynamic arrays called ArrayList.
But your solution doesn't need them, just think about what Chrono79 said.
It is possible to know its size beforehand.
Strings in Java are immutable, but if you reassign them, your command should do what you want.
str = str.replaceAll(" ","");
If you want to remove all non-visible characters (e.g. tab, \n), go with:
str = str.replaceAll("\s+","")
not case sensitive
若测试用例有2位数字的话,这个答案就不适用了
Thank you!
I am sorry, want just know why I am able to pass all your tests besides your sample.
Loading more items...