Refactor String extension methods