The goal of today's challenge is to translate English into Pig Latin. This challenge comes from user2505876 on CodeWars.
Write a function that mo...
For further actions, you may consider blocking this person and/or reporting abuse
CSS (kind of)
Separate the words in
<span>
s, and add the class "piglatin" to the container.The idea is based on floating the first letter to the right using the pseudo-class
:first-letter
, and then adding "ay" using the pseudo-element::after
... although it doesn't work well with punctuation :-/You can see a demo running on CodePen:
Screen readers still read the sentences right, even when visually they are in pig latin.
So happy to see another CSS solution! It's been awhile lol
Hell of a job!
Yes. The last ones have been impossible. But 4-5 out of 22 is not that bad :P
Oh, this is nice! ☺️
Here goes a JavaScript oneliner
And just for fun, an unPigIt oneliner too!
Nailed it 👌🔥🔥
Perl one-liner as well
This one handles leaving punctuation alone, so this would work as well:
No need to split and join:
Of course. Thanks!
python one liner ftw.
Ruby 2.6
Rust Solution!
I paid specific attention to the punctuation rule, and made sure to get that right!
I also wasn't satisfied with just the example punctuation because nobody spaces out their punctuation like that ! See doesn't that look weird ?
Also the spec doesn't mention at all with how to treat words with punctuation IN them! So I made my own spec here and decided to split the words on any punctuation, and treat each side as it own word. Proper pig latin? Maybe not! But it's doing what I intended!
Here is the simple solution with Python:
Elixir:
gist.github.com/devparkk/f27cf3cef...
Your pig latin rules are incorrect in the Examples. Words beginning with vowels do not move the first letter and traditionally end in 'way'. So pig_it('Pig latin is cool') should be # igPay atinlay isway oolcay