code for string manipulation