add begin and end method implementations for string class