# Converting unevaluated lists to strings

I have a list like

l = {2 - 3, 12 - 4, Times, aab}


I want to end up with

{"2-3", "12-4", "Times", "aab"}

I have tried

lh = Map[ToString, HoldForm[l], {2}]


Which gives the promising result

{ToString[2-3],ToString[12-4],ToString[Times],ToString[aab]}

However when I add ReleaseHold the numerical values get evaluated (then converted to strings).

ReleaseHold@lh


{"-1", "8", "Times", "aab"}

How can I achieve the fully unevaluated string form?

This question may be a duplicate. If so, I apologise.

ToString /@ HoldForm /@ Unevaluated@{2 - 3, 12 - 4, Times, aab}


or

HoldForm /@ Unevaluated@{2 - 3, 12 - 4, Times, aab} /. x_ :> ToString @ x


both give

 (* {"2 - 3", "12 - 4", "Times", "aab"} *)


That might be the ugliest way to do it, but it works:

list = HoldForm@{2 - 3, 12 - 4, Times, aab};
string = ToString@list
listString =
StringSplit[StringReplace[string, {"{" -> "", "}" -> "", " " -> ""}], ","]


{"2-3", "12-4", "Times", "aab"}

Then, ToExpression /@ listString yields:

{-1, 8, Times, aab}

• This doesn't work properly for cases such as l = {Add[a, b], Mul[b, c]}
– Aky
May 20, 2014 at 15:42
• It doesn't work if you have a comma indeed.
– Öskå
May 20, 2014 at 16:05