It's Not 2015 Anymore!
JavaScript ES6, 84 76 75 bytes
s=>(q=s.replace(/2015/g,"<s>$&</s>*"))+(s<q?`
*2016. I'm a year early!`:"")
This is pretty well golfed for JavaScript imo.
This works by taking the input and replacing all instances of 2015
with <s>$&</s>*
where $&
is the value matched, but in this case, that's always 2015
. Then, if the input is different from q
, it'll add the *2016...
string, otherwise, It'll add a blank string (nothing).
Ruby, 69 bytes
$><<gets.gsub(/2015/,'<s>\&</s>*')
puts"*2016. I'm a year early!"if$&
Jolf, 60 bytes
Two parts, again.
oHρi"2015"+pd"s'$&'*"
oH set H
ρi"2015" to input string, replaced all 2015 with
pd"s'$&' $& crossed out. (pd is an apply tag function)
+ *" append an asterisk
v-- unprintable
+H|&?=Hi+S"*2016. I\'m a year early!'"
+H|&?=Hi '" add ↓ to H if H != i; otherwise add empty string ('")
+S"*2016. I\'m a year early!' a newline plus that string
implicit printing
Try it here! Bonus points for actually crossing out the text and conforming to the output examples? :3