string::TrimLeft

Description

Trim leading whitespace characters from the string. It removes newline, space, and tab characters.


Removes a particular character from the beginning of this string.


Removes a group of particular characters from the begining of the string.

Syntax

void TrimLeft( )

void TrimLeft( char chTarget )

void TrimLeft( LPCSTR lpszTargets )

Parameters

chTarget
[input]character to be trimmed.

lpszTargets
[input] A pointer to a string containing the target characters to be trimmed.

Return

None


None.


None.

Examples

EX1

//Trim left whitespace characters from the string
void string_TrimLeft_ex1()
{
    string str="   Hello World";
    str.TrimLeft();
    out_str(str);//"Hello World"
}


EX2

//Removes a particular character from the begining of the string
void string_TrimLeft_ex2()
{
    string str="aaabbbcccaaa";
    str.TrimLeft('a');
    out_str(str);//"bbbcccaaa"
}


EX3

//Removes a group of particular characters from the begining of the string
void string_TrimLeft_ex3()
{
    string str = "  ######\t\tOrigin is good!\t##";
    str.TrimLeft(" #\t");
    out_str(str);//"Origin is good!        ##"    
}

Remark

See Also

string::Format, string::Left, string::MakeLower, string::MakeUpper, string::Mid, string::Right

header to Include

origin.h