Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 colouring a single word
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
josh




PostPosted: Mon Apr 12, 2004 9:06 am   Post subject: colouring a single word

How do you make it so that one word in a sentance is differnt than the next?

code:

colour(10)

put "bob went to the house."



How would I make the word "went" a different colour than the rest of the sentance?
Sponsor
Sponsor
Sponsor
sponsor
Raugrist




PostPosted: Mon Apr 12, 2004 9:22 am   Post subject: Re: colouring a single word

rhysticlight wrote:
How do you make it so that one word in a sentance is differnt than the next?

code:

colour(10)

put "bob went to the house."



How would I make the word "went" a different colour than the rest of the sentance?

Like this pretty much:
code:

colour (10)
put "bob "..
colour (11)
put "went "..
colour (12)
put "to "..
colour (13)
put "the "..
colour (14)
put "house"

Which sucks pretty much. You could also (maybe) split the setence up into an array where each cell is a word, but that's pretty ugly. But why do you want each word in a sentence to be a different colour? That could have a really ugly look.
Paul




PostPosted: Mon Apr 12, 2004 9:23 am   Post subject: (No subject)

put "bob"..
colour(10)put" went"..
colour (1)put " to the house."
josh




PostPosted: Mon Apr 12, 2004 9:50 am   Post subject: (No subject)

kk thanx I jsut want to colour one word in a sentancde like bolding it to make it stand out.
Delos




PostPosted: Tue Apr 13, 2004 4:36 pm   Post subject: (No subject)

code:

var sentance : string := "bob went to look for colours"
var key : string := "went"

colour (7)
put sentance (1..index(sentance, key)-1)..
colour (12)
put sentance (index(sentance, key)..index(sentance, key) + length(key))..
colour (7)
put sentance (index(sentance, key) + length(key) + 1..*)


Will only work for one incidence of 'key'.
josh




PostPosted: Tue Apr 13, 2004 4:47 pm   Post subject: (No subject)

that seems like alot of work to just bold one owrd, but thanx for the sugestion. I already did it the other way and it worked.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: