Well, this solution will work in every case but won't be able to handle the 21775 "ie" words:
antidote=(s)=>s.split`. `.map(b=>{b=b.replace(/ie/gi,'ei');return b[0].toUpperCase()+b.slice(1).toLowerCase()}).join`. `
antidote("He haD iEght ShOTs of CAffIEne. aFter thaT HE WenT tO SleeP.") // "He had eight shots of caffeine. After that he went to sleep."
I was doing something like this. Then I deid testing.
There's a known set of rules to avoid handle all the "ie" words:
en.wikipedia.org/wiki/I_before_E_e...
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Well, this solution will work in every case but won't be able to handle the 21775 "ie" words:
I was doing something like this. Then I deid testing.
There's a known set of rules to avoid handle all the "ie" words:
en.wikipedia.org/wiki/I_before_E_e...