ENH: Added string_as_repr method
Adresses the issue #46744

The issue's author suggested creating a new module for this function/method, however, I think it is not a viable solution for a contributor to do. Instead, I added this method to string.py, however, I'm not sure if that's the right place for it to be added. 
Agreed. I think this needs a bit more discussion before moving forward so closing for now