5
1
Your task is to input a string, and output the number of spaces in the string.
This is code-golf, so least number of bytes win. Your
Test Cases
Double quotes are not part of the test cases.
"test" => 0
"Hello, World!" => 1
"C O D E G O L F" => 7
" " => 6
4What characters can be in the string? Just printable ASCII, or can there be unicode characters, tabs, newlines etc? – Jo King – 2019-09-19T05:56:26.210
What is considered a space? Only 32@ASCII or other whitespace characters too? – Grzegorz Oledzki – 2019-09-19T08:21:54.917
@JoKing Just printable ASCII if you want. – HighlyRadioactive – 2019-09-19T11:01:49.190
@JoKing It is probably not a duplicate since - You don't have to input the character you need to find, which allows for cool solutions for example: Retina, 1 byte
.(Not created for it though) – HighlyRadioactive – 2019-09-19T11:03:48.410
3I don't think having one of the parameters hard-coded changes the challenge enough to not make it a dupe – Jo King – 2019-09-19T11:30:57.857
1@JoKing But I don't think there's a lot of challenge which have an 1-byte Retina solution. Also, space are special for a lot of languages, see APL answer, 05AB1E answer and so much more. – HighlyRadioactive – 2019-09-19T14:08:08.853
@JoKing I won't argue, though. This is my first closed challenge! – HighlyRadioactive – 2019-09-19T14:08:37.360