Default constructor, creates a new empty string object
Constructs a string object from a null-terminated string.
Constructs a string object from a character that is repeated nRepeat times.
Constructs a string object from an array of characters of length nlength,
not null-terminated.
Constructs a string object from any _VARIANT type variable which holds a string
string( )
string( LPCSTR lpcszSrc )
string( char ch, int nRepeat = 1 )
string( LPCTSTR lpch, int nLength )
string( _VARIANT var )
None.
None.
None.
None.
EX1
void string_string_ex1() { string str1; //empty string bool bRet = str1.IsEmpty(); out_int("", bRet)//true }
EX2
void string_string_ex2() { string str2("cow"); //create from a string literal out_str(str2);//"cow" }
EX3
void string_string_ex3() { string str3('a',6); out_str(str3);//"aaaaaa" }
EX4
void string_string_ex4() { char * str = "Origin C"; int nLength = 6;//Set length 6,Only store the first 6 characters of string string str4(str,nLength); out_str(str4);//"Origin" }
EX5
void string_string_ex5() { _VARIANT obj; string s = "Hello"; obj = s; string str = obj; }
origin.h