I have the following pure ASCII character list:
list ={"a", "\\:1d62", "\\:2081", "\\[Beta]", "\\:2081", " ", "+", " ", \
"a", "\\:1d62", "\\:2082", "\\[Beta]", "\\:2082", " ", "+", " ", ".", \
".", ".", " ", "+", " ", "a", "\\:2099", "\\:2081", "\\[Beta]", \
"\\:2099", " ", "=", " ", "b", "\\:1d62"}
How can I convert it to Mathematica Input Form ?
I tried: FromCharacterCode[ToString[#, "ASCII"] &/@list
But it does not work.
Answer
As @Rohit suggests in the comments, one possibility is to use ToExpression
. However, to be safer, one might want to use Symbol
instead. So:
Replace[
list,
a_ /; StringLength[a] > 1 :> Check[SymbolName @ Symbol[a], $Failed],
{1}
] //InputForm
{"a", "ᵢ", "₁", "β", "₁", " ", "+", " ", "a", "ᵢ", "₂", "β", "₂", " ", "+", " ", ".", ".", ".", " ", "+", " ", "a", "ₙ", "₁", "β", "ₙ", " ", "=", " ", "b", "ᵢ"}
Comments
Post a Comment