ADD: ConsoleColor_StringLength() to get the normal string length that doesn't count the escape/markup

This commit is contained in:
michaelangel007 2014-11-30 17:47:26 -08:00
parent fe8ce31c19
commit d5a58ef206

View File

@ -184,6 +184,27 @@
return g;
}
// Return the string length without the markup
inline int ConsoleColor_StringLength( const char *pText )
{
const char *pSrc = pText;
/* */ int nLen = 0;
if( pText )
{
while( *pSrc )
{
if( ConsoleColor_IsCharMeta( *pSrc ) )
pSrc++;
else
nLen++;
pSrc++;
}
}
return nLen;
}
// Globals __________________________________________________________________
// Buffer