Parsing Ascii Colour Codes (they look like this --> [1;31m)
Does anyone know of a way to parse incoming text for ascii colour codes ([1;31m for example which is red) so that all text that follows the code is a certain colour? I.E, the MUD server at the other end which sends me the text with the codes in it sends:
|[1;36m "[1;37mDream the dream and let it come true...[1;36m" [1;37m|
which should, when parsed, show the following:
| "Dream the dream and let it come true..." |
Any ideas? The source is downloadable from http://members.lycos.co.uk/vinarianl.../esmud_src.zip and the compiled version from http://members.lycos.co.uk/vinarianlegends/esmud.zip. If you can help, it'd be appreciated.
Oh, and while I remember, there's an annoying problem with that code where it adds a CrLf at the end of every line, but I don't want it to, because then you get loads of blank lines. If oyu run the prog, you'll see what I mena, but anyway, is there a way to search the incoming text line by line and remove the crlf fromthe end of each line? The server sends its text in UNIX format if that's any help... I got around that by using RTF boxes instead of normal text boxes, but it doubles the CrLf's rather than completely ignoring them. I'm confusing myself to... :(
Ben.
P.S. The source is based heavily on a tutorial from www.vbip.com, so no moaning about "Oh, you didn't write all of this", because I know I didn't, OK? I didn't know much about WinSocks until last night. *pokes*