cleanup: Replace deprecated String.prototype.substr()
I stumbled upon a note in the documentation that states that the method is deprecated.
While that mostly applies to a web context, it doesn't hurt replacing it. Not least because having two very similarly named methods that do the same thing, but work slightly differently is a bit awkward.