string.c
changeset 5101 797a070e5b22
parent 4914 5e36af0cfb1d
child 5108 dc67d70b5a45
equal deleted inserted replaced
5100:f9d3e09bb0e2 5101:797a070e5b22
    70 {
    70 {
    71 	for (; *str != '\0'; str++)
    71 	for (; *str != '\0'; str++)
    72 		if (!IsValidAsciiChar(*str, CS_ALPHANUMERAL)) *str = '?';
    72 		if (!IsValidAsciiChar(*str, CS_ALPHANUMERAL)) *str = '?';
    73 }
    73 }
    74 
    74 
       
    75 void str_strip_colours(char *str)
       
    76 {
       
    77 	char *dst = str;
       
    78 	for (; *str != '\0';) {
       
    79 		if (*str >= 15 && *str <= 31) { // magic colour codes
       
    80 			str++;
       
    81 		} else {
       
    82 			*dst++ = *str++;
       
    83 		}
       
    84 	}
       
    85 	*dst = '\0';
       
    86 }
       
    87 
    75 /**
    88 /**
    76  * Only allow certain keys. You can define the filter to be used. This makes
    89  * Only allow certain keys. You can define the filter to be used. This makes
    77  *  sure no invalid keys can get into an editbox, like BELL.
    90  *  sure no invalid keys can get into an editbox, like BELL.
    78  * @param key character to be checked
    91  * @param key character to be checked
    79  * @param afilter the filter to use
    92  * @param afilter the filter to use