ADD: ConsoleColor_StringLength() to get the normal string length that doesn't count the escape/markup
This commit is contained in:
parent
fe8ce31c19
commit
d5a58ef206
1 changed files with 21 additions and 0 deletions
|
@ -184,6 +184,27 @@
|
||||||
return g;
|
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 __________________________________________________________________
|
// Globals __________________________________________________________________
|
||||||
|
|
||||||
// Buffer
|
// Buffer
|
||||||
|
|
Loading…
Add table
Reference in a new issue