Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #9824

Re: Coloured strings

From David Bailey <dave@removedbailey.co.uk>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Coloured strings
Date 2012-04-27 10:49 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jndtk0$jje$1@smc.vnet.net> (permalink)
References <201204250432.AAA06468@smc.vnet.net> <jnb48n$5ap$1@smc.vnet.net>

Show all headers | View raw


On 26/04/2012 10:24, Adriano Pascoletti wrote:
> ToString[<coloured string>] removes colors
> Adriano Pascoletti
>
> 2012/4/25 David Bailey<dave@removedbailey.co.uk>
>
>> 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
>>
>>
Thanks,

what a simple and elegant solution! Somehow I would never have thought 
of feeding a string to ToString.

David Bailey
http://www.dbaileyconsultancy.co.uk

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Re: Coloured strings Adriano Pascoletti <adriano.pascoletti@uniud.it> - 2012-04-26 09:24 +0000
  Re: Coloured strings David Bailey <dave@removedbailey.co.uk> - 2012-04-27 10:49 +0000

csiph-web