Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #9797 > unrolled thread
| Started by | Christoph Lhotka <christoph.lhotka@fundp.ac.be> |
|---|---|
| First post | 2012-04-26 09:28 +0000 |
| Last post | 2012-04-26 09:28 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Coloured strings Christoph Lhotka <christoph.lhotka@fundp.ac.be> - 2012-04-26 09:28 +0000
| From | Christoph Lhotka <christoph.lhotka@fundp.ac.be> |
|---|---|
| Date | 2012-04-26 09:28 +0000 |
| Subject | Re: Coloured strings |
| Message-ID | <jnb4gd$5ei$1@smc.vnet.net> |
hi, found by chance for the example str = \!\(\* TagBox[ StyleBox["\"\<\\!\\(\\*\\nStyleBox[\\(AB\\*\\n \ StyleBox[\\\"CDE\\\",\\nFontSize->24]\\*\\n \ StyleBox[\\\"FGHIJKLMNOPQRS\\\",\\nFontColor->RGBColor[0.6, 0.4, \ 0.2]]TUVWXYZ\\)]\\)\>\"", ShowSpecialCharacters->False, ShowStringCharacters->True, NumberMarks->True], FullForm]\) "\* StyleBox[\(AB\!\(\* StyleBox[\"CDE\",\nFontSize->24]\)\!\(\* StyleBox[\"FGHIJKLMNOPQRS\",\nFontColor->RGBColor[0.6, 0.4, \ 0.2]]\)TUVWXYZ\)]" that ToString converts to OutputForm and removes the formatting: In[2]:= ToString[str] Out[2]= "ABCDEFGHIJKLMNOPQRSTUVWXYZ" Hope that helps, Christoph On 04/25/2012 06:32 AM, David Bailey wrote: > If you take an expression such as: > "ABCDEFGHIJKLMNOPQRSTUVWXYZ"//FullForm > > and colour some portions of the string, you obtain: > > \!\(\* > TagBox[ > StyleBox["\"\<\\!\\(\\*\\nStyleBox[\\(ABC\\*\\n StyleBox[\\\"DEF\\\",\ > \\nFontColor->RGBColor[1, 0, 0]]GHIJKLMN\\*\\n \ > StyleBox[\\\"OPQRSTUV\\\",\\nFontColor->RGBColor[0, 0, 1]]WXYZ\\)]\\)\ > \>\"", > ShowSpecialCharacters->False, > ShowStringCharacters->True, > NumberMarks->True], > FullForm]\) > > I am wondering if anyone knows an easy way to remove the colouring from > such a string - other than creating a fairly complicated string pattern > (bearing in mind that the original string might contain unpaired quotes, > etc!) > > David Bailey > http://www.dbaileyconsultancy.co.uk >
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web