I was going to do something like this, but I couldn't reason out which of the delete vs the substr would happen first. It occurred to me, reading your post, that substr doesn't actually modify the string like splice modifies arrays -- so it doesn't matter.