cmText.h/c : Added cmTextLastWhiteChar().
This commit is contained in:
parent
72a4c2f3dd
commit
a4020934ee
20
cmText.c
20
cmText.c
@ -498,6 +498,26 @@ const cmChar_t* cmTextLastNonWhiteCharC( const cmChar_t* s )
|
|||||||
{ return cmTextLastNonWhiteChar(s); }
|
{ return cmTextLastNonWhiteChar(s); }
|
||||||
|
|
||||||
|
|
||||||
|
cmChar_t* cmTextLastWhiteChar( const cmChar_t* s )
|
||||||
|
{
|
||||||
|
unsigned n;
|
||||||
|
if(s==NULL || (n = strlen(s)) == 0 )
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
cmChar_t* s0 = (cmChar_t*)s + n-1;
|
||||||
|
|
||||||
|
for(; s0>=s; --s0)
|
||||||
|
if( isspace(*s0) )
|
||||||
|
return s0;
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const cmChar_t* cmTextLastWhiteCharC( const cmChar_t* s )
|
||||||
|
{ return cmTextLastWhiteChar(s); }
|
||||||
|
|
||||||
|
|
||||||
void cmTextShrinkS( cmChar_t* s, const cmChar_t* t, unsigned tn )
|
void cmTextShrinkS( cmChar_t* s, const cmChar_t* t, unsigned tn )
|
||||||
{ cmVOC_Shrink(s,strlen(s)+1,t,tn); }
|
{ cmVOC_Shrink(s,strlen(s)+1,t,tn); }
|
||||||
|
|
||||||
|
5
cmText.h
5
cmText.h
@ -146,9 +146,14 @@ extern "C" {
|
|||||||
const cmChar_t* cmTextEndOfLineC( const cmChar_t* s );
|
const cmChar_t* cmTextEndOfLineC( const cmChar_t* s );
|
||||||
|
|
||||||
// Return a pointer to the last non-white character in the string
|
// Return a pointer to the last non-white character in the string
|
||||||
|
// or NULL if s is NULL or empty.
|
||||||
cmChar_t* cmTextLastNonWhiteChar( const cmChar_t* s );
|
cmChar_t* cmTextLastNonWhiteChar( const cmChar_t* s );
|
||||||
const cmChar_t* cmTextLastNonWhiteCharC( const cmChar_t* s );
|
const cmChar_t* cmTextLastNonWhiteCharC( const cmChar_t* s );
|
||||||
|
|
||||||
|
// Return a pointer to the last white character in the string
|
||||||
|
// or NULL if s is NULL or empty.
|
||||||
|
cmChar_t* cmTextLastWhiteChar( const cmChar_t* s );
|
||||||
|
const cmChar_t* cmTextLastWhiteCharC( const cmChar_t* s );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user