# How do I convert an expression to a string while keeping -> as one symbol?

When I write ToString[a->b], regardless of whether the input uses the right-arrow symbol or - and > separately, it comes out as "a -> b" with - and >. If I just write "->" but with the right-arrow symbol, that's what I get in the output, so it's possible to get the arrow to show up in a string, but is there a good way to do this without having to break up the expression before using ToString?

• does ToString[a -> b, StandardForm] give what you want? – kglr Dec 14 '20 at 0:30
• @kglr Yes, thank you! – Blrp Dec 14 '20 at 0:34

## 1 Answer

You can use StandardForm in the second argument of ToString:

ToString[a -> b, StandardForm]