Skip to main content
Commonmark migration
Source Link

#Java 8, 32 bytes

Java 8, 32 bytes

a->b->a.replaceAll("\\d*$","")+b

Takes input a as a String, and for b it doesn't matter whether it's a String or integer (although I use Integer in the TIO-link below).

Try it here.

#Java 8, 32 bytes

a->b->a.replaceAll("\\d*$","")+b

Takes input a as a String, and for b it doesn't matter whether it's a String or integer (although I use Integer in the TIO-link below).

Try it here.

Java 8, 32 bytes

a->b->a.replaceAll("\\d*$","")+b

Takes input a as a String, and for b it doesn't matter whether it's a String or integer (although I use Integer in the TIO-link below).

Try it here.

Source Link
Kevin Cruijssen
  • 131.5k
  • 13
  • 144
  • 384

#Java 8, 32 bytes

a->b->a.replaceAll("\\d*$","")+b

Takes input a as a String, and for b it doesn't matter whether it's a String or integer (although I use Integer in the TIO-link below).

Try it here.