Implemented all string methods and added error handling