Why "1j" instead simply (!) "j" ??
I saw a random test like this: solution('apples, pears\ngrapes\nbananas !\nbananas', ['!']) should equal 'apples, pears\ngrapes\nbananas'
solution('apples, pears\ngrapes\nbananas !\nbananas', ['!'])
"!\nbananas" should be an empty comment followed by a new line containing "bananas"
@steffan153
Crystal translation does not appear to rstrip lines:
solution("! oranges cherries\ncherries cherries cherries lemons\nwatermelons cherries lemons cherries pears , \nbananas . oranges ! pears pears\n^ bananas cherries lemons avocados #", ["'", "^", "#"]) Expected: "! oranges cherries\ncherries cherries cherries lemons\nwatermelons cherries lemons cherries pears , \nbananas . oranges ! pears pears\n" got: nil ^^^^^^^^^
reproducing: default code -> attempt -> ctrl+f " \n" (space followed by line terminator, without the quotes)
" \n"
edit: nvm I have no idea what I'm talking about
Where do you read leading spaces must be removed?
Any whitespace at the end of the line should also be stripped out.
Use markdown formatting when posting code, otherwise spaces are collapsed and we can't see what you wanted to show:
solution("'\n# watermelons , , \noranges watermelons watermelons watermelons bananas\npears bananas pears lemons # ?", ["'", "@", ".", "-", "^"]) Expected: "\n# watermelons , , \noranges watermelons watermelons watermelons bananas\npears bananas pears lemons # ?" got: "\n# watermelons , ,\noranges watermelons watermelons watermelons bananas\npears bananas pears lemons # ?"
Which language are you talking about?
Test cases are inconsistent. The spec states to strip leading and trailing whitespace. And yet:
The test case expects a string with trailing whitespace preserved, not stripped.
comments are only for the rest of that line (better if you show the test case, or it will be assumed that you're not accurately describing it.)
There are cases where "\n" is part of the comment and others where "\n" ends the comment ... Which one is right?
And hurry up if you will or your ships will sink before you even found them on the field.
Yes, and it's up to your code to figure out which one it is.
[1,1,1,1 ...] can be 1 battleship, 2 destroyers, 1 submarine + 1 cruizer, 2 submarines + 1 destroyer, 4 submarines...
Now, resolved.
No you don't. You copy and paste it into your test cases.
Loading collection data...
Why "1j" instead simply (!) "j" ??
I saw a random test like this:
solution('apples, pears\ngrapes\nbananas !\nbananas', ['!'])
should equal 'apples, pears\ngrapes\nbananas'but if the comment ends with \n ...
"!\nbananas" should be an empty comment followed by a new line containing "bananas"
@steffan153
Crystal translation does not appear to rstrip lines:
reproducing: default code -> attempt -> ctrl+f
" \n"
(space followed by line terminator, without the quotes)edit: nvm I have no idea what I'm talking about
Where do you read leading spaces must be removed?
Use markdown formatting when posting code, otherwise spaces are collapsed and we can't see what you wanted to show:
Which language are you talking about?
Test cases are inconsistent. The spec states to strip leading and trailing whitespace. And yet:
solution("'\n# watermelons , , \noranges watermelons watermelons watermelons bananas\npears bananas pears lemons # ?", ["'", "@", ".", "-", "^"])
Expected: "\n# watermelons , , \noranges watermelons watermelons watermelons bananas\npears bananas pears lemons # ?"
got: "\n# watermelons , ,\noranges watermelons watermelons watermelons bananas\npears bananas pears lemons # ?"
The test case expects a string with trailing whitespace preserved, not stripped.
comments are only for the rest of that line
(better if you show the test case, or it will be assumed that you're not accurately describing it.)
There are cases where "\n" is part of the comment and others where "\n" ends the comment ... Which one is right?
And hurry up if you will or your ships will sink before you even found them on the field.
Yes, and it's up to your code to figure out which one it is.
[1,1,1,1 ...] can be 1 battleship, 2 destroyers, 1 submarine + 1 cruizer, 2 submarines + 1 destroyer, 4 submarines...
Now, resolved.
No you don't. You copy and paste it into your test cases.
Loading more items...