Today's challenge requires you to write a function which removes all question marks from a given string.
For example:
hello?
would behello
This challenge comes from aikedaa here on DEV.
Want to propose a challenge idea for a future post? Email yo+challenge@dev.to with your suggestions!
Top comments (41)
Hey there! Nice to see some bash users here.
You can even use bash without sed using this little trick:
Try it online.
See Manipulating String.
ruby <3
x86_64 assembly (System V ABI, GNU assembler), as usual:
bsure.S:
bsure.h:
JavaScript
Here is my take to the challenge:
Source-Code
Available online.
Side-note
By the name of the title in my notifications, I really though that the challenge would be to write a challenge and submit the best to the Dev.to team as they were running out of ideas. Haha!
Tomorrows challenge:
Oh, sounds sexy. I love it! Haha.
Please submit challenge ideas! Simply email yo+challenge@dev.to with any proposals and we'll give you credit when we post it :)
Javascript:
Called as:
Important to note, this will also remove the first escape characters (
\
) and output newlines in template literals as\n
Rust
Playground
... ๐
I mean... that's not even a function to write. It's a function to call.
Elixir:
Ruby:
JavaScript:
Bash:
Okay, I'll bite and imagine that Carmen Sandiego has stolen all the regular expressions!
And to use it:
NOOOO!!!
You need to create an instance of the
OpinionAboutJavaFactory
! You can just have a staticgetOpinionAboutJava
method! Now your code is not SOLID!ENTERPRISE
(javascript)
Uses a simple regular expressions with the global (
g
) modifier to find all the?
(this needs to be escaped in a regular expression, so\?
) and replace them with the empty string''
.Ruby