Complete the solution so that it strips all text that follows any of a set of comment markers passed in. Any whitespace at the end of the line should also be stripped out.
Example:
Given an input string of:
apples, pears # and bananas
grapes
bananas !apples
The output expected would be:
apples, pears
grapes
bananas
The code would be called like so:
var result = solution("apples, pears # and bananas\ngrapes\nbananas !apples", ["#", "!"])
// result should == "apples, pears\ngrapes\nbananas"
'매일매일개발 > Codewars' 카테고리의 다른 글
codewars #66 Inside Out Strings (6kyu) (0) | 2018.06.22 |
---|---|
codewars #65 Split Strings (6kyu) (0) | 2018.06.21 |
codewars #63 Sort two arrays (5kyu) (0) | 2018.06.19 |
codewars #62 Simple Pig Latin (5kyu) (0) | 2018.06.18 |
codewars #61 Build a pile of Cubes (6kyu) (0) | 2018.06.15 |