Posted: 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
Raugrist
Posted: 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
Posted: Mon Apr 12, 2004 9:23 am Post subject: (No subject)
put "bob"..
colour(10)put" went"..
colour (1)put " to the house."
josh
Posted: 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
Posted: 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
Posted: 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.