Author Topic: IRC Colours stripping  (Read 2577 times)

Windlord

  • Guest
IRC Colours stripping
« on: January 11, 2011, 03:13:14 pm »
Code: (squirrel) [Select]
// This function strips the IRC colours off of a string
// Good to use with the IRC echo
function StripCol ( text )
{
local a, z = text.len(), l;
local coltrig = false, comtrig = false, num = 0, output = "";
for ( a = 0; a < z; a++ )
{
l = text[ a ];
if ( l == 3 ) { coltrig = !coltrig; num = 0; comtrig = false; }
else if ( coltrig && num < 2 && l < 58 && 47 < l ) { num++; }
else if ( coltrig && !comtrig && l == 44 ) { comtrig = true; num = 0; }
else { num = 2; comtrig = false; output += l.tochar(); }
}
return output;
}

 

© Liberty Unleashed Team.