string::GetLength

Description

Return the number of bytes (or number of characters) in this string object. The count does not include a null terminator.

Syntax

int GetLength( )

Parameters

Return

An integer value equal to the length (number of bytes minus the null character) of this string.

Examples

EX1

void string_GetLength_ex1()
{
    string str( "cow" );
    int nRet = str.GetLength();
    out_int("", nRet);//3
    
    str.Empty();
    nRet = str.GetLength();
    out_int("", nRet);//0
}

Remark

See Also

header to Include

origin.h