Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Lensflare17480187dHere is a suggestion for the implementation:
let blacklist = ["recovery", "hacker", "cryptocurrency"]
func downvote(post: String) -> Bool {
for entry in blacklist {
if post.caseInsensitiveContains(entry) {
return true
}
}
return false
} -
devRancid648186dAnd in a more sane language than swift, look at this abomination 🤢
if string.range(of: regex, options: .regularExpression, range: nil, locale: nil) != nil ...
superior js: if (regex.test(string)) -
Lensflare17480186d@devRancid this is obviously designed so that you can also check where it matches (not only if it matches)
You can easily make an extension which will look and behave just as the js one.
But if you want to do it the other way around and make js do what swift does… good luck, pal.
People desperately trying to make js look good are hilarious.
Related Rants
I think it's time to make a devrant bot automatically downvoting spam posts and spin it as 2 instances. Any takers? :)
fight automatism with automatism
robot fights of 2024 😁
devrant
random