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!
Latest comments (41)
Python
My solution in js
As simple as it sounds, in python :
I see. Also
%
literal is my favorite string literal :)I love weird Ruby syntax😆
TIPS:
??
is known as character literal notationdocs.ruby-lang.org/en/trunk/syntax...
Perl solution:
The
tr
operator works like thetr
shell util./d
means non-replaced characters are deleted,/r
returns the value instead of modifying the bound variable.Python:
`
And to use it:
ENTERPRISE
NOOOO!!!
You need to create an instance of the
OpinionAboutJavaFactory
! You can just have a staticgetOpinionAboutJava
method! Now your code is not SOLID!I intentionally avoided using
sed
this time, wanted to implement it with "pure" Bash. Usingsed
the implementation, of course, becomes much shorter.Well, since we're doing cmd things...
(bash on mac)
x86_64 assembly (System V ABI, GNU assembler), as usual:
bsure.S:
bsure.h:
sed
is overkill. Trytr
:PHP:
Even though this is a simple one - it's really interesting to see all of the different ways you can do it!
But I agree with Josh - it's built into most languages :)