Strings - Fixed compiler warning

This commit is contained in:
Emmanuel BENOîT 2018-12-15 18:45:53 +01:00
parent 30d8d3057e
commit e2f548d55e

View file

@ -1425,24 +1425,27 @@ T_String T_String::trim( ) const noexcept
return T_String( );
}
T_Optional< uint32_t > firstNws;
bool hasFirst = false;
uint32_t firstNws = 0;
uint32_t lastNws = 0;
T_StringIterator it( *this );
while ( !it.atEnd( ) ) {
T_Character c( it );
if ( !c.isWhitespace( ) ) {
if ( !firstNws ) {
if ( !hasFirst ) {
firstNws = it.index( );
hasFirst = true;
}
lastNws = it.index( );
}
it.next( );
}
if ( !firstNws ) {
if ( hasFirst ) {
return range( firstNws , lastNws );
} else {
return T_String( );
}
return range( *firstNws , lastNws );
}
/*----------------------------------------------------------------------------*/