ToExpression[RowBox[{"a","(*","what", "*)"}],StandardForm]
This conversion above ignores the commment content (*what*)
The result I expected is something like the DisplayForm
below.
RowBox[{"a","(*","what","*)"}]//DisplayForm
Update: one of my test code, how to improve it, and not use (StringReplace
) if possible.
RowBoxtoString[x_]:=StringReplace[
ToString[ToExpression[x/.RowBox[{"(*",t_,"*)"}]:>"CommentLeft"<>(StringJoin@@t)<>"ComentRight"],
StandardForm],
Shortest["CommentLeft"~~t__~~"ComentRight"]:>"(*"<>t<>"*)"]
RowBoxtoString[RowBox[{"(*","Comment Content","*)"}]]
(*Comment Content*)