space at the end

This commit is contained in:
Jidong Xiao
2023-08-29 12:47:44 -04:00
parent cdb5dcf7dc
commit 3f0db51780

View File

@@ -267,7 +267,7 @@ object. There are several ways of constructing string objects:
By default to create an empty string: std::string my_string_var; By default to create an empty string: std::string my_string_var;
With a specified number of instances of a single char: std::string my_string_var2(10, ' '); With a specified number of instances of a single char: std::string my_string_var2(10, ' ');
From another string: std::string my_string_var3(my_string_var2); From another string: std::string my_string_var3(my_string_var2);
- The notation my_string_var.size() is a call to a function size that is defined as a member function of the string class. There is an equivalent member function called length. - The notation my_string_var.size() is a call to a function *size* that is defined as a member function of the string class. There is an equivalent member function called *length*.
- Input to string objects through streams (e.g. reading from the keyboard or a file) includes the following steps: - Input to string objects through streams (e.g. reading from the keyboard or a file) includes the following steps:
1. The computer inputs and discards white-space characters, one at a time, until a non-white-space character is found. 1. The computer inputs and discards white-space characters, one at a time, until a non-white-space character is found.
2. A sequence of non-white-space characters is input and stored in the string. This overwrites anything that was already in the string. 2. A sequence of non-white-space characters is input and stored in the string. This overwrites anything that was already in the string.
@@ -281,7 +281,7 @@ object. There are several ways of constructing string objects:
(and length()). (and length()).
The :: notation means that size type is defined within the scope of the string type. The :: notation means that size type is defined within the scope of the string type.
string::size_type is generally equivalent to unsigned int. string::size_type is generally equivalent to unsigned int.
You may see have compiler warnings and potential compatibility problems if you compare an int variable to a.size(). You may see compiler warnings and potential compatibility problems if you compare an int variable to a.size().
## 1.16 C++ vs. Java ## 1.16 C++ vs. Java