14.02.2011, 10:24
I couldn't find an answer for my problem, so I decided to post it here.
I have a function which should color-select a part of a string.
For example, I have the next string: "This is a simple 'text line' in my string".
I need somehow to make the new string look like: "This is a simple {FFFFFF}text line{NORMAL COLOR} in my string".
NORMAL COLOR - the default color I work with
FFFFF - Another color to "select" the needed text.
I need a way to replace the first " ' " with the selected color, to check where it ends and to set it back to the normal color (replace the second " ' " with the normal hex color - {}).
It would be easily done with scanf, but I also need to check each time how many selected words I have in my string. Each word which is between " ' " tags, should be color-selected.
I would be glad to get some help, thank you.
I have a function which should color-select a part of a string.
For example, I have the next string: "This is a simple 'text line' in my string".
I need somehow to make the new string look like: "This is a simple {FFFFFF}text line{NORMAL COLOR} in my string".
NORMAL COLOR - the default color I work with
FFFFF - Another color to "select" the needed text.
I need a way to replace the first " ' " with the selected color, to check where it ends and to set it back to the normal color (replace the second " ' " with the normal hex color - {}).
It would be easily done with scanf, but I also need to check each time how many selected words I have in my string. Each word which is between " ' " tags, should be color-selected.
I would be glad to get some help, thank you.