Menu

Post image 1
Post image 2
1 / 2
0

A much faster mgsub

DEV Community·Mark·27 days ago
#1jHTR5en
Reading 0:00
15s threshold

I've never thought of myself as a developer and honestly, neither have most other people. My job for the last several years has been anything but, despite the juice I try to squeeze from that orange. But there was a glorious time back in 2018 when I was part of an awesome team and we would challenge each other solve problems in interesting ways (not coincidentally when I last posted here). One of these problems seemed pretty minor at first but turned into a fun solve - how do you simultaneously substitute multiple strings safely? So you have 'hey, ho, let's go!' and you want to replace 'hey' with 'ho' and 'ho' with 'hey' (it's a dumb example, I know). If you do your substitutions one at a time you end up with either 'hey, hey' or 'ho, ho' depending on the order. In the R language (I grew up as a statistician and it will always be my first love) I solved it and I felt pretty proud.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More