Crossware

Table of Contents        Previous topic       Next topic       

C++ COMPILER LIBRARY FUNCTIONS->String Class Functions->Member Functions->assign

#include <string>

string& assign(const string& str, size_t pos, size_t n)

Replaces the data of an object of class string with the data of str starting at str[pos]. The amount of data appended is the smaller of n and str.size()  pos

Returns a reference to the string to which the data has been assigned.

string& assign(const char* s, size_t n)

Replaces the data of an object of class string with the array of char of length n with a first element s to the data.

Returns a reference to the string to which the data has been appended.

string& assign(const char* s)

Replaces the data of an object of class string with the array of char of length strlen(s) with a first element s to the data.

Returns a reference to the string to which the data has been appended.

string& assign(size_t n, char c)

Replaces the data of an object of class string with n copies of the c.

Returns a reference to the string to which the data has been appended.