Add `as_c_str` method on strings

Formerly this was a free function rather than a method. I've left it in place for now, although redefined it so that it just calls the method.