src/libtsduck/base/tsUString.cpp
void ts::UString::trim(bool leading, bool trailing)
{
    if (trailing) {
        size_type index = length();
        while (index > 0 && IsSpace((*this)[index-1])) {
            index--;
        }
        erase(index);
    }
    if (leading) {
        size_type index = 0;
        const size_type len = length();
        while (index < len && IsSpace((*this)[index])) {
            index++;
        }
        erase(0, index);
    }
}
//----------------------------------------------------------------------------
// Trim leading & trailing spaces in the string
//----------------------------------------------------------------------------
Trim leading & trailing spaces in the string
Trim leading & trailing spaces in the string
void ts::UString::trim(bool leading, bool trailing)
{
    if (trailing) {
        size_type index = length();
        while (index > 0 && IsSpace((*this)[index-1])) {
            index--;
        }
        erase(index);
    }
    if (leading) {
        size_type index = 0;
        const size_type len = length();
        while (index < len && IsSpace((*this)[index])) {
            index++;
        }
        erase(0, index);
    }
}
void ts :: UString :: trim ( bool leading , bool trailing ) { if ( trailing ) { size_type index = length ( ) ; while ( index > 0 && IsSpace ( ( * this ) [ index - 1 ] ) ) { index -- ; } erase ( index ) ; } if ( leading ) { size_type index = 0 ; const size_type len = length ( ) ; while ( index < len && IsSpace ( ( * this ) [ index ] ) ) { index ++ ; } erase ( 0 , index ) ; } }
Trim leading & trailing spaces in the string
Trim leading & trailing spaces in the string