From: dennis@starlifter.reichel.net

> I'm using Lope's color code, and I need to know how to get the length of a
> string without counting spaces for the color designators ( {R ).
> 
> for instance:   "Thybalt the {WImmortal of {BLaw{x"
> 
> strlen returns 33, but I need it to ignore the color stuff and return 27.
>  Help, please?

This function should do the trick.

/*
 * This is a modified version of a function written by Wreck.
 * Original at http://http://dark.nrg.dtu.dk/~wreck/mud/code/color.txt
 *
 * With the modifications, it should be compatible with the newest
 * version of Lope's colour code.
 *
 * Note: I haven't tested this.  It may not work perfectly.
 *						Dennis Reed
 */
int strlen_color( char *argument )
{
    char        *str;
    int         length;

    if ( argument==NULL || argument[0]=='\0' )
        return 0;

    length=0;
    str=argument;

    while ( *str != '\0' )
    {
        if ( *str != '{' )
        {
            str++;
            length++;
            continue;
        }

        if (*(++str) == '{')
	    length++;

        str++;
    }

    return length;
}


If this doesn't work completely, it shouldn't take too much work to get it
to do so.

Hope this helps.
Dennis
