Refactor string utility.