MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

a way to escape strings for export


(the first line is needed, because it trips something inside
Mathematica that defines the generateNumericEntityFromCharacterCode
function)

this is useful for XML, XHTML, etc export

In[1]:=
XML`MathML`BoxesToMathML["\[Beta]"];
In[2]:=
escapeStringXML[strxpr_String]:=
  Apply[StringJoin,

If[Or[33\[LessEqual]#\[LessEqual]127,#\[Equal]10],FromCharacterCode[#],

System`Convert`XMLDump`generateNumericEntityFromCharacterCode@#]&/@
      ToCharacterCode[strxpr]]
In[3]:=
escapeStringXML["\[Beta]\[Alpha]+1-2g\[Zeta]"]
Out[3]=
βα+1-2gζ


  • Prev by Date: Re: ParametricPlot3D of the Mesh
  • Next by Date: Re: Selecting table rows
  • Previous by thread: Re: Issue
  • Next by thread: Image Processing