# StringSplit acting weird on a String in StandardForm [closed]

To begin, this is my first post on stack exchange, so if my question is not up to par please let me know so I can make the appropriate edits. Now for my question: why is it that parsing a string in StandardForm often gives strange results? How can this be avoided? Take the following case. Consider some quantity

 M= X[{2,0},{2,0}]+X[{3,0},{1,0}]


I want to convert it to a string in StandardForm and then parse the result by splitting at the plus sign. First, the obvious result without StandardForm comes from

Str[F_]:=ToString[F]
StringSplit[Str[M],"+"]


and is

{"X[{2, 0}, {2, 0}] ", " X[{3, 0}, {1, 0}]"}


Great. But now I impose standard form,

Str[F_]:=ToString[F,StandardForm]
StringSplit[Str[M],"+"]


and suddenly the output is

      {"\!$$\(\(X[\(\(\(\({2, 0}$$\), $$\({2, 0}$$\)\)\)]\)\) ", " $$\(X[\(\ \(\(\({3, 0}$$\), $$\({1, 0}$$\)\)\)]\)\)\)"}


Why is this happening and how can I avoid it? For various reasons, it is really a necessity for me to use StandardForm here, so I can't just leave that out.

Thanks!

• The extra "\"s are from the string representation of the boxes. Why not splitting the expression and then convert to standard form? For example ToString[#, StandardForm] & /@ (M /. Plus -> List) – xslittlegrass May 1 '16 at 5:09
• I was quite frankly not even aware of the concept of boxes until I read your comment - thank you for the help! At the risk of being very off topic, could I ask another question related to this project? How do I stop mathematica from combining terms in expressions into powers - ie I want things to stay in the form X[...]X[...] instead of (X[...])^2, both during evaluation and at output. Thanks again! – physicist-trying-to-program May 1 '16 at 23:01
• Use HoldForm for this: HoldForm[x[1] x[1]] (but it is off-topic, of course). – Alexey Popkov May 2 '16 at 15:40