7.5.4
String Handling Class Library
The header file for the string handling class library is as follows:
Defines class string.
This class has no derivation.
|
|
|
Type
|
iterator
|
char* type.
|
const_iterator
|
const char* type.
|
Constant
|
npos
|
Maximum string length (UNIT_MAX characters).
|
Variable
|
s_ptr
|
Pointer to the memory area where the string is stored by the object.
|
s_len
|
The length of the string stored by the object.
|
s_res
|
Size of the allocated memory area to store string by the object.
|
Function
|
string(void)
|
Constructor.
|
string(
const string& str,
size_t pos = 0,
size_t n = npos)
|
string(const char* str, size_t n)
|
string(const char* str)
|
string(size_t n, char c)
|
~string()
|
Destructor.
|
string& operator=(const string& str)
|
Assigns str.
|
string& operator=(const char* str)
|
string& operator=(char c)
|
Assigns c.
|
iterator begin()
|
Calculates the start pointer of the string.
|
const_iterator begin() const
|
iterator end()
|
Calculates the end pointer of the string.
|
const_iterator end() const
|
size_t size() const
|
Calculates the length of the stored string.
|
size_t length() const
|
size_t max_size() const
|
Calculates the size of the allocated memory area.
|
void resize(size_t n, char c)
|
Changes the storable string length to n.
|
void resize(size_t n)
|
Changes the storable string length to n.
|
size_t capacity() const
|
Calculates the size of the allocated memory area.
|
void reserve(size_t res_arg = 0)
|
Performs re-allocation of the memory area.
|
void clear()
|
Clears the stored string.
|
bool empty() const
|
Checks whether the stored string length is 0.
|
Function
|
const char& operator[](size_t pos) const
|
References s_ptr[pos].
|
char& operator[](size_t pos)
|
const char& at(size_t pos) const
|
char& at(size_t pos)
|
tring& operator+=(const string& str)
|
Adds string str.
|
string& operator+=(const char* str)
|
string& operator+=(char c)
|
Adds character c.
|
string& append(const string& str)
|
Adds string str.
|
string& append(const char* str)
|
string& append(
const string& str,
size_t pos,
size_t n)
|
Adds n characters of string str at object position pos.
|
string& append(const char* str, size_t n)
|
Adds n characters to string str.
|
string& append(size_t n, char c)
|
Adds n characters, each of which is c.
|
string& assign(const string& str)
|
Assigns string str.
|
string& assign(const char* str)
|
string& assign(
const string& str,
size_t pos,
size_t n)
|
Add n characters to string str at position pos.
|
string& assign(const char* str, size_t n)
|
Assigns n characters of string str.
|
string& assign(size_t n, char c)
|
Assigns n characters, each of which is c.
|
string& insert(size_t pos1, const string& str)
|
Inserts string str to position pos1.
|
string& insert(
size_t pos1,
const string& str,
size_t pos2,
size_t n)
|
Inserts n characters starting from position pos2 of string str to position pos1.
|
string& insert(
size_t pos,
const char* str,
size_t n)
|
Inserts n characters of string str to position pos.
|
string& insert(size_t pos, const char* str)
|
Inserts string str to position pos.
|
string& insert(size_t pos, size_t n, char c)
|
Inserts a string of n characters, each of which is c, to position pos.
|
iterator insert(iterator p, char c = char())
|
Inserts character c before the string specified by p.
|
void insert(iterator p, size_t n, char c)
|
Inserts n characters, each of which is c, before the character specified by p.
|
string& erase(size_t pos = 0, size_t n = npos)
|
Deletes n characters from position pos.
|
Function
|
iterator erase(iterator position)
|
Deletes the character referenced by position.
|
iterator erase(iterator first, iterator last)
|
Deletes the characters in range [first, last].
|
string& replace(
size_t pos1,
size_t n1,
const string& str)
|
Replaces the string of n1 characters starting from position pos1 with string str.
|
string& replace(
size_t pos1,
size_t n1,
const char* str)
|
string& replace(
size_t pos1,
size_t n1,
const string& str,
size_t pos2,
size_t n2)
|
Replaces the string of n1 characters starting from position pos1 with string of n2 characters from position pos2 of str.
|
string& replace(
size_t pos,
size_t n1,
const char* str,
size_t n2)
|
Replaces the string of n1 characters starting from position pos with string str of n2 characters.
|
string& replace(
size_t pos,
size_t n1,
size_t n2,
char c)
|
Replaces the string of n1 characters starting from position pos with n2 characters, each of which is c.
|
string& replace(
iterator i1,
iterator i2,
const string& str)
|
Replaces the string from position i1 to i2 with string str.
|
string& replace(
iterator i1,
iterator i2,
const char* str)
|
string& replace(
iterator i1,
iterator i2,
const char* str,
size_t n)
|
Replaces the string from position i1 to i2 with n characters of string str.
|
string& replace(
iterator i1,
iterator i2,
size_t n,
char c)
|
Replaces the string from position i1 to i2 with n characters, each of which is c.
|
size_t copy(
char* str,
size_t n,
size_t pos = 0) const
|
Copies the first n characters of string str to position pos.
|
void swap(string& str)
|
Swaps *this with string str.
|
Function
|
const char* c_str() const
|
References the pointer to the memory area where the string is stored.
|
const char* data() const
|
size_t find(
const string& str,
size_t pos = 0) const
|
Finds the position where the string same as string str first appears after position pos.
|
size_t find(
const char* str,
size_t pos = 0) const
|
size_t find(
const char* str,
size_t pos,
size_t n) const
|
Finds the position where the string same as n characters of str first appears after position pos.
|
size_t find(char c, size_t pos = 0) const
|
Finds the position where character c first appears after position pos.
|
size_t rfind(
const string& str,
size_t pos = npos) const
|
Finds the position where a string same as string str appears most recently before position pos.
|
size_t rfind(
const char* str,
size_t pos = npos) const
|
size_t rfind(
const char* str,
size_t pos, size_t n) const
|
Finds the position where the string same as n characters of str appears most recently before position pos.
|
size_t rfind(char c, size_t pos = npos)
const
|
Finds the position where character c appears most recently before position pos.
|
size_t find_first_of(
const string& str,
size_t pos = 0) const
|
Finds the position where any character included in string str first appears after position pos.
|
size_t find_first_of(
const char* str,
size_t pos = 0) const
|
size_t find_first_of(
const char* str,
size_t pos, size_t n) const
|
Finds the position where any character included in n characters of string str first appears after position pos.
|
size_t find_first_of(
char c, size_t pos = 0) const
|
Finds the position where character c first appears after position pos.
|
size_t find_last_of(
const string& str,
size_t pos = npos) const
|
Finds the position where any character included in string str appears most recently before position pos.
|
size_t find_last_of(
const char* str,
size_t pos = npos) const
|
size_t find_last_of(
const char* str,
size_t pos,
size_t n) const
|
Finds the position where any character included in n characters of string str appears most recently before position pos.
|
Function
|
size_t find_last_of(
char c,
size_t pos = npos) const
|
Finds the position where character c appears most recently before position pos.
|
size_t find_first_not_of(
const string& str,
size_t pos = 0) const
|
Finds the position where a character different from any character included in string str first appears after position pos
|
size_t find_first_not_of(
const char* str,
size_t pos = 0) const
|
size_t find_first_not_of(
const char* str,
size_t pos, size_t n) const
|
Finds the position where a character different from any character in the first n characters of string str appears after position pos.
|
size_t find_first_not_of(
char c,
size_t pos = 0) const
|
Finds the position where a character different from c first appears after position pos.
|
size_t find_last_not_of(
const string& str,
size_t pos = npos) const
|
Finds the position where a character different from any character included in string str appears most recently before position pos.
|
size_t find_last_not_of(
const char* str,
size_t pos = npos) const
|
size_t find_last_not_of(
const char* str,
size_t pos, size_t n) const
|
Finds the position where a character different from any character in the first n characters of string str appears most recently before position pos.
|
size_t find_last_not_of(
char c,
size_t pos = npos) const
|
Finds the position where a character different from c appears most recently before position pos.
|
string substr(
size_t pos = 0,
size_t n = npos) const
|
Creates an object from a string in the range [pos,n] of the stored string.
|
int compare(const string& str) const
|
Compares the string with string str.
|
int compare(
size_t pos1,
size_t n1,
const string& str) const
|
Compares n1 characters from position pos1 of *this with str.
|
int compare(
size_t pos1,
size_t n1,
const string& str,
size_t pos2,
size_t n2) const
|
Compares the string of n1 characters from position pos1 with the string of n2 characters from position pos2 of string str.
|
int compare(const char* str) const
|
Compares *this with string str.
|
int compare(
size_t pos1,
size_t n1,
const char* str,
size_t n2 = npos) const
|
Compares the string of n1 characters from position pos1 with n2 characters of string str.
|
Sets as follows:
s_ptr = 0;
s_len = 0;
s_res = 1;
string::string(const string& str, size_t pos = 0, size_t n = npos)
|
Copies str. Note that s_len will be the smaller value of n and s_len.
string::string(const char* str, size_t n)
|
Sets as follows:
s_ptr = str;
s_len = n;
s_res = n + 1;
string::string(const char* str)
|
Sets as follows:
s_ptr = str;
s_len = length of string str;
s_res = length of string str + 1;
string::string(size_t n, char c)
|
Sets as follows:
s_ptr = string of n characters, each of which is c
s_len = n;
s_res = n + 1;
Destructor of class string.
Deallocates the memory area where the string is stored.
string& string::operator(const string& str)
|
Assigns the data of str.
Return value: *this
string& string::operator=(const char* str)
|
Creates a string object from str and assigns its data to the string object.
Return value: *this
string& string::operator=(char c)
|
Creates a string object from c and assigns its data to the string object.
Return value: *this
string::iterator string::begin()
|
Calculates the start pointer of the string.
Return value: Start pointer of the string.
string::const_iterator string::begin() const
|
Calculates the start pointer of the string.
Return value: Start pointer of the string.
string::iterator string::end()
|
Calculates the end pointer of the string.
Return value: End pointer of the string.
string::const_iterator string::end() const
|
Calculates the end pointer of the string.
Return value: End pointer of the string.
size_t string::size() const
|
Calculates the length of the stored string.
Return value: Length of the stored string.
size_t string::length() const
|
Calculates the length of the stored string.
Return value: Length of the stored string.
size_t string::max_size() const
|
Calculates the size of the allocated memory area.
Return value: Size of the allocated area.
void string::resize(size_t n, char c)
|
Changes the number of characters in the string that can be stored by the object to n.
If n<=size(), replaces the string with the original string with length n.
If n>size(), replaces the string with a string that has c appended to the end so that the length will be equal to n.
The length must be n<=max_size().
If n>max_size(), the string length is n=max_size().
void string::resize(size_t n)
|
Changes the number of characters in the string that can be stored by the object to n.
If n<=size(), replaces the string with the original string with length n.
The length must be n<=max_size.
size_t string::capacity() const
|
Calculates the size of the allocated memory area.
Return value: Size of the allocated memory area
void string::reserve(size_t res_arg = 0)
|
Re-allocates the memory area.
After reserve(), capacity() will be equal to or larger than the reserve() parameter.
When the memory area is re-allocated, all references, pointers, and iterator that references the elements of the numeric sequence become invalid.
Clears the stored string.
bool string::empty() const
|
Checks whether the number of characters in the stored string is 0.
Return value: If the length of the stored string is 0: true
If the length of the stored string is not zero: false
const char& string::operator[ ](size_t pos) const
|
References s_ptr[pos].
Return value: If n< s_len: s_ptr [pos]
If n>= s_len: '\0'
char& string::operator[ ](size_t pos)
|
References s_ptr[pos].
Return value: If n< s_len: s_ptr [pos]
If n>= s_len: '\0'
const char& string::at(size_t pos) const
|
References s_ptr[pos].
Return value: If n< s_len: s_ptr [pos]
If n>= s_len: '\0'
char& string::at(size_t pos)
|
References s_ptr[pos].
Return value: If n< s_len: s_ptr [pos]
If n>= s_len: '\0'
string& string::operator+=(const string& str)
|
Appends the string stored in str to the object.
Return value: *this
string& string::operator+=(const char* str)
|
Creates a string object from str and adds the string to the object.
Return value: *this
string& string::operator+=(char c)
|
Creates a string object from c and adds the string to the object.
Return value: *this
string& string::append(const string& str)
|
Appends string str to the object.
Return value: *this
string& string::append(const char* str)
|
Appends string str to the object.
Return value: *this
string& string::append(const string& str, size_t pos, size_t n);
|
Appends n characters of string str to the object position pos.
Return value: *this
string& string::append(const char* str, size_t n)
|
Appends n characters of string str to the object.
Return value: *this
string& string::append(size_t n, char c)
|
Appends n characters, each of which is c, to the object.
Return value: *this
string& string::assign(const string& str)
|
Assigns string str.
Return value: *this
string& string::assign(const char* str)
|
Assigns string str.
Return value: *this
string& string::assign(const string& str, size_t pos, size_t n)
|
Assigns n characters of string str to position pos.
Return value: *this
string& string::assign(const char* str, size_t n)
|
Assigns n characters of string str.
Return value: *this
string& string::assign(size_t n, char c)
|
Assigns n characters, each of which is c.
Return value: *this
string& string::insert(size_t pos1, const string& str)
|
Inserts string str to position pos1.
Return value: *this
string& string::insert(size_t pos1, const string& str, size_t pos2, size_t n)
|
Inserts n characters starting from position pos2 of string str to position pos1.
Return value: *this
string& string::insert(size_t pos, const char* str, size_t n)
|
Inserts n characters of string str to position pos.
Return value: *this
string& string::insert(size_t pos, const char* str)
|
Inserts string str to position pos.
Return value: *this
string& string::insert(size_t pos, size_t n, char c)
|
Inserts a string of n characters, each of which is c, to position pos.
Return value: *this
string::iterator string::insert(iterator p, char c = char())
|
Inserts character c before the string specified by p.
Return value: The inserted character
void string::insert(iterator p, size_t n, char c)
|
Inserts n characters, each of which is c, before the character specified by p.
string& string::erase(size_t pos = 0, size_t n = npos)
|
Deletes n characters starting from position pos.
Return value: *this
iterator string::erase(iterator position)
|
Deletes the character referenced by position.
Return value: If the next iterator of the element to be deleted exists: The next iterator of the deleted element
If the next iterator of the element to be deleted does not exist: end()
iterator string::erase(iterator first, iterator last)
|
Deletes the characters in range [first, last].
Return value: If the next iterator of last exists: The next iterator of last
If the next iterator of last does not exist: end()
string& string::replace(size_t pos1, size_t n1, const string& str)
|
Replaces the string of n1 characters starting from position pos1 with string str.
Return value: *this
string& string::replace(size_t pos1, size_t n1, const char* str)
|
Replaces the string of n1 characters starting from position pos1 with string str.
Return value: *this
string& string::replace(size_t pos1, size_t n1, const string& str, size_t pos2, size_t n2)
|
Replaces the string of n1 characters starting from position pos1 with the string of n2 characters starting from position pos2 in string str.
Return value: *this
string& string::replace(size_t pos, size_t n1, const char* str, size_t n2)
|
Replaces the string of n1 characters starting from position pos1 with n2 characters of string str.
Return value: *this
string& string::replace(size_t pos, size_t n1, size_t n2, char c)
|
Replaces the string of n1 characters starting from position pos with n2 characters, each of which is c.
Return value: *this
string& string::replace(iterator i1, iterator i2, const string& str)
|
Replaces the string from position i1 to i2 with string str.
Return value: *this
string& string::replace(iterator i1, iterator i2, const char* str)
|
Replaces the string from position i1 to i2 with string str.
Return value: *this
string& string::replace(iterator i1, iterator i2, const char* str, size_t n)
|
Replaces the string from position i1 to i2 with n characters of string str
Return value: *this
string& string::replace(iterator i1, iterator i2, size_t n, char c)
|
Replaces the string from position i1 to i2 with n characters, each of which is c.
Return value: *this
size_t string::copy(char* str, size_t n, size_t pos = 0) const
|
Copies n characters of string str to position pos.
Return value: rlen
void string::swap(string& str)
|
Swaps *this with string str.
const char* string::c_str() const
|
References the pointer to the memory area where the string is stored.
Return value: s_ptr
const char* string::data() const
|
References the pointer to the memory area where the string is stored.
Return value: s_ptr
size_t string::find(const string& str, size_t pos = 0) const
|
Finds the position where the string same as string str first appears after position pos.
Return value: Offset of string.
size_t string::find (const char* str, size_t pos = 0) const
|
Finds the position where the string same as string str first appears after position pos.
Return value: Offset of string.
size_t string::find(const char* str, size_t pos, size_t n) const
|
Finds the position where the string same as n characters of string str first appears after position pos.
Return value: Offset of string.
size_t string::find(char c, size_t pos = 0) const
|
Finds the position where character c first appears after position pos.
Return value: Offset of string.
size_t string::rfind(const string& str, size_t pos = npos) const
|
Finds the position where a string same as string str appears most recently before position pos.
Return value: Offset of string.
size_t string::rfind(const char* str, size_t pos = npos) const
|
Finds the position where a string same as string str appears most recently before position pos.
Return value: Offset of string.
size_t string::rfind(const char* str, size_t pos, size_t n) const
|
Finds the position where the string same as n characters of string str appears most recently before position pos.
Return value: Offset of string.
size_t string::rfind(char c, size_t pos = npos) const
|
Finds the position where character c appears most recently before position pos.
Return value: Offset of string.
size_t string::find_first_of(const string& str, size_t pos = 0) const
|
Finds the position where any character included in string str first appears after position pos.
Return value: Offset of string.
size_t string::find_first_of(const char* str, size_t pos = 0) const
|
Finds the position where any character included in string str first appears after position pos.
Return value: Offset of string.
size_t string::find_first_of(const char* str, size_t pos, size_t n) const
|
Finds the position where any character included in n characters of string str first appears after position pos.
Return value: Offset of string.
size_t string::find_first_of(char c, size_t pos = 0) const
|
Finds the position where character c first appears after position pos.
Return value: Offset of string.
size_t string::find_last_of(const string& str, size_t pos = npos) const
|
Finds the position where any character included in string str appears most recently before position pos.
Return value: Offset of string.
size_t string::find_last_of(const char* str, size_t pos = npos) const
|
Finds the position where any character included in string str appears most recently before position pos.
Return value: Offset of string.
size_t string::find_last_of(const char* str, size_t pos, size_t n) const
|
Finds the position where any character included in n characters of string str appears most recently before position pos.
Return value: Offset of string.
size_t string::find_last_of(char c, size_t pos = npos) const
|
Finds the position where character c appears most recently before position pos.
Return value: Offset of string.
size_t string::find_first_not_of(const string& str, size_t pos = 0) const
|
Finds the position where a character different from any character included in string str first appears after position pos.
Return value: Offset of string.
size_t string::find_first_not_of(const char* str, size_t pos = 0) const
|
Finds the position where a character different from any character included in string str first appears after position pos.
Return value: Offset of string.
size_t string::find_first_not_of(const char* str, size_t pos, size_t n) const
|
Finds the position where a character different from any character in the first n characters of string str first appears after position pos.
Return value: Offset of string.
size_t string::find_first_not_of(char c, size_t pos = 0) const
|
Finds the position where a character different from character c first appears after position pos.
Return value: Offset of string.
size_t string::find_last_not_of(const string& str, size_t pos = npos) const
|
Finds the position where a character different from any character included in string str appears most recently before position pos.
Return value: Offset of string.
size_t string::find_last_not_of(const char* str, size_t pos = npos) const
|
Finds the position where a character different from any character included in string str appears most recently before position pos.
Return value: Offset of string.
size_t string::find_last_not_of(const char* str, size_t pos, size_t n) const
|
Finds the position where a character different from any character in the first n characters of string str appears most recently before position pos.
Return value: Offset of string.
size_t string::find_last_not_of(char c, size_t pos = npos) const
|
Finds the position where a character different from character c appears most recently before position pos.
Return value: Offset of string.
string string::substr(size_t pos = 0, size_t n = npos) const
|
Creates an object from a string in the range [pos,n] of the stored string.
Return value: Object with a string in the range [pos,n].
int string::compare(const string& str) const
|
Compares the string with string str.
Return value: If the strings are the same: 0
If the strings are different: 1 when this->s_len > str.s_len,
-1 when this->s_len < str.s_len
int string::compare(size_t pos1, size_t n1, const string& str) const
|
Compares a string of n1 characters starting from position pos1 of *this with string str.
Return value: If the strings are the same: 0
If the strings are different: 1 when this->s_len > str.s_len,
-1 when this->s_len < str.s_len
int string::compare(size_t pos1, size_t n1, const string& str, size_t pos2, size_t n2) const
|
Compares a string of n1 characters starting from position pos1 with the string of n2 characters from position pos2 of string str.
Return value: If the strings are the same: 0
If the strings are different: 1 when this->s_len > str.s_len,
-1 when this->s_len < str.s_len
int string::compare(const char* str) const
|
Compares *this with string str.
Return value: If the strings are the same: 0
If the strings are different: 1 when this->s_len > str.s_len,
-1 when this->s_len < str.s_len
int string::compare(size_t pos1, size_t n1, const char* str, size_t n2 = npos) const
|
Compares the string of n1 characters from position pos1 with n2 characters of string str.
Return value: If the strings are the same: 0
If the strings are different: 1 when this->s_len > str.s_len,
-1 when this->s_len < str.s_len
(b) | string Class Manipulators |
|
|
|
Function
|
string operator +(
const string& lhs,
const string& rhs)
|
Appends the string (or characters) of rhs to the string (or characters) of lhs, creates an object and stores the string in the object.
|
string operator+(const char* lhs, const string& rhs)
|
string operator+(char lhs, const string& rhs)
|
string operator+(const string& lhs, const char* rhs)
|
string operator+(const string& lhs, char rhs)
|
bool operator==(
const string& lhs,
const string& rhs)
|
Compares the string of lhs with the string of rhs.
|
bool operator==(const char* lhs, const string& rhs)
|
bool operator==(const string& lhs, const char* rhs)
|
bool operator!=(const string& lhs, const string& rhs)
|
Compares the string of lhs with the string of rhs.
|
bool operator!=(const char* lhs, const string& rhs)
|
bool operator!=(const string& lhs, const char* rhs)
|
bool operator<(const string& lhs, const string& rhs)
|
Compares the string length of lhs with the string length of rhs.
|
bool operator<(const char* lhs, const string& rhs)
|
Compares the string length of lhs with the string length of rhs.
|
bool operator<(const string& lhs, const char* rhs)
|
Function
|
bool operator>(const string& lhs, const string& rhs)
|
Compares the string length of lhs with the string length of rhs.
|
bool operator>(const char* lhs, const string& rhs)
|
bool operator>(const string& lhs, const char* rhs)
|
bool operator<=(
const string& lhs,
const string& rhs)
|
Compares the string length of lhs with the string length of rhs.
|
bool operator<=(const char* lhs, const string& rhs)
|
bool operator<=(const string& lhs, const char* rhs)
|
bool operator>=(const string& lhs, const string& rhs)
|
Compares the string length of lhs with the string length of rhs.
|
bool operator>=(const char* lhs, const string& rhs)
|
bool operator>=(const string& lhs, const char* rhs)
|
void swap(string& lhs, string& rhs)
|
Swaps the string of lhs with the string of rhs.
|
istream& operator>>(istream& is, string& str)
|
Extracts the string to str.
|
ostream& operator<<(
ostream& os,
const string& str)
|
Inserts string str.
|
istream& getline(
istream& is,
string& str,
char delim)
|
Extracts a string from is and appends it to str. If delim is found in the string, input is stopped.
|
istream& getline(istream& is, string& str)
|
Extracts a string from is and appends it to str. If a new-line character is detected, input is stopped.
|
string operator+(const string& lhs, const string& rhs)
|
Appends the string (characters) of lhs with the strings (characters) of rhs, creates an object and stores the string in the object.
Return value: Object where the linked strings are stored.
string operator+(const char* lhs, const string& rhs)
|
Appends the string (characters) of lhs with the strings (characters) of rhs, creates an object and stores the string in the object.
Return value: Object where the linked strings are stored.
string operator+(char lhs, const string& rhs)
|
Appends the string (characters) of lhs with the strings (characters) of rhs, creates an object and stores the string in the object.
Return value: Object where the linked strings are stored.
string operator+(const string& lhs, const char* rhs)
|
Appends the string (characters) of lhs with the strings (characters) of rhs, creates an object and stores the string in the object.
Return value: Object where the linked strings are stored.
string operator+(const string& lhs, char rhs)
|
Appends the string (characters) of lhs with the strings (characters) of rhs, creates an object and stores the string in the object.
Return value: Object where the linked strings are stored.
bool operator==(const string& lhs, const string& rhs)
|
Compares the string of lhs with the string of rhs.
Return value: If the strings are the same: true
If the strings are different: false
bool operator==(const char* lhs, const string& rhs)
|
Compares the string of lhs with the string of rhs.
Return value: If the strings are the same: true
If the strings are different: false
bool operator==(const string& lhs, const char* rhs)
|
Compares the string of lhs with the string of rhs.
Return value: If the strings are the same: true
If the strings are different: false
bool operator!=(const string& lhs, const string& rhs)
|
Compares the string of lhs with the string of rhs.
Return value: If the strings are the same: false
bool operator!=(const char* lhs, const string& rhs)
|
Compares the string of lhs with the string of rhs.
Return value: If the strings are the same: false
bool operator!=(const string& lhs, const char* rhs)
|
Compares the string of lhs with the string of rhs.
Return value: If the strings are the same: false
If the strings are different: true
bool operator<(const string& lhs, const string& rhs)
|
Compares the string length of lhs with the string length of rhs.
Return value: If lhs.s_len < rhs.s_len: true
If lhs.s_len >= rhs.s_len: false
bool operator<(const char* lhs, const string& rhs)
|
Compares the string length of lhs with the string length of rhs.
Return value: If lhs.s_len < rhs.s_len: true
If lhs.s_len >= rhs.s_len: false
bool operator<(const string& lhs, const char* rhs)
|
Compares the string length of lhs with the string length of rhs.
Return value: If lhs.s_len < rhs.s_len: true
If lhs.s_len >= rhs.s_len: false
bool operator>(const string& lhs, const string& rhs)
|
Compares the string length of lhs with the string length of rhs.
Return value: If lhs.s_len > rhs.s_len: true
bool operator>(const char* lhs, const string& rhs)
|
Compares the string length of lhs with the string length of rhs.
Return value: If lhs.s_len > rhs.s_len: true
bool operator>(const string& lhs, const char* rhs)
|
Compares the string length of lhs with the string length of rhs.
Return value: If lhs.s_len > rhs.s_len: true
If lhs.s_len <= rhs.s_len: false
bool operator<=(const string& lhs, const string& rhs)
|
Compares the string length of lhs with the string length of rhs.
Return value: If lhs.s_len <= rhs.s_len: true
If lhs.s_len > rhs.s_len: false
bool operator<=(const char* lhs, const string& rhs)
|
Compares the string length of lhs with the string length of rhs.
Return value: If lhs.s_len <= rhs.s_len: true
If lhs.s_len > rhs.s_len: false
bool operator<=(const string& lhs, const char* rhs)
|
Compares the string length of lhs with the string length of rhs.
Return value: If lhs.s_len <= rhs.s_len: true
If lhs.s_len > rhs.s_len: false
bool operator>=(const string& lhs, const string& rhs)
|
Compares the string length of lhs with the string length of rhs.
Return value: If lhs.s_len >= rhs.s_len: true
If lhs.s_len < rhs.s_len: false
bool operator>=(const char* lhs, const string& rhs)
|
Compares the string length of lhs with the string length of rhs.
Return value: If lhs.s_len >= rhs.s_len: true
If lhs.s_len < rhs.s_len: false
bool operator>=(const string& lhs, const char* rhs)
|
Compares the string length of lhs with the string length of rhs.
Return value: If lhs.s_len >= rhs.s_len: true
If lhs.s_len < rhs.s_len: false
void swap(string& lhs,string& rhs)
|
Swaps the string of lhs with the string of rhs.
istream& operator>>(istream& is, string& str)
|
Extracts a string to str.
Return value: is
ostream& operator<<(ostream& os, const string& str)
|
Inserts string str.
Return value: os
istream& getline(istream& is, string& str, char delim)
|
Extracts a string from is and appends it to str.
If delim is found in the string, the input is stopped.
Return value: is
istream& getline(istream& is, string& str)
|
Extracts a string from is and appends it to str.
If a new-line character is found, the input is stopped.
Return value: is