refactored String and StringBuilder related codes