A string only containing the following characters:
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.?! (space at the end) and two special characters (
Mirror the text based on the position(s) of the
_ mirrors horizontally and
| mirrors vertically.
- The first
_indicates the start of the mirroring of that substring, the second
- If just one
_is present, you can continue on until the end of the string.
- If more then two
_are present, the same process repeats.
- There can only be one
|in the string, and this reversed the first substring and removes the second substring.
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.?! (space at the end) will be converted to
ɐqɔpǝɟɓɥıɾʞlɯuodbɹsʇnʌʍxʎz∀𐐒ƆᗡƎℲ⅁HIſ⋊⅂WNOԀΌᴚS⊥∩ΛMX⅄Z0⇂ᘔƐ߈ϛ9ㄥ86˙¿¡ (space at the end) when it is mirrored by
_ (click the link for the unicode values - requires unicode v8.0+).
Example input 1:
_Will I be mirrored?!
Mıll I qǝ ɯıɹɹoɹǝp¿¡
Example input 2:
Wi_ll I be mi_rrored?!
Will I qǝ ɯırrored?!
When it is mirrored by
| we simply reverse the substring from 0 to index-of-
Example input 1:
Will I be mirror|ed?!
Will I be mirrorrorrim eb I lliW
Both mirrors (
|) can be present in the string.
- This is code-golf, so shortest answer in bytes wins.
Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.
- Standard rules apply for your answer, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters, full programs. Your call.
- Default Loopholes are forbidden.
- If possible, please add a link with a test for your code.
- Also, please add an explanation if necessary.
_Will I be mirrored?! -> Mıll I qǝ ɯıɹɹoɹǝp¿¡ Wi_ll I be mi_rrored?! -> Will I qǝ ɯırrored?! Will I be mirror|ed?! -> Will I be mirrorrorrim eb I lliW This_ is a test_ cont_aining bo|t_h mirrors. -> This ıs ɐ ʇǝsʇ contɐıuıuɓ qooq ɓuıuıɐtnoc ʇsǝʇ ɐ sı sihT 0_1_2_3_4_5|_6_7_8_9 -> 0⇂2Ɛ4ϛϛ4Ɛ2⇂0