Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

coloring only some substring

  • To: mathgroup at smc.vnet.net
  • Subject: [mg55085] coloring only some substring
  • From: fartous at mail15.com
  • Date: Fri, 11 Mar 2005 04:21:50 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

thanks all for the solutions to coloring "to" substring, but these will not 
color "to" in the string "bottom" , any ideas?
lst = {"to", "be", "or", "not", "to", "be", "bottom"};
lst /. x : "to" -> StyleForm[x, FontColor -> Hue[1]]

Or:

lst /. "to" -> "!(* StyleBox["to",FontColor->RGBColor[1, 0, 0]])"

Or:
lst /. "to" -> StyleForm["to", FontColor -> RGBColor[0, 0, 1]]

thanks
jack
>>i have the list:
>>lst={"to","be","or","not","to","be","bottom"}
>>how to search for the string "to" and then to output the whole content of 
>>List
>>lst but with the substring "to" colored in red.
>>thanks
>>
>>jack


  • Prev by Date: Re: InitializationCell
  • Next by Date: how to set a global assumption setting Every Varaible I use is Real?
  • Previous by thread: Re: coloring only some substring
  • Next by thread: substrings at the end of words