You could replace all of this with a simple replace(TOKEN, "")