Skip to content

Commit 5107709

Browse files
TylerMSFTTylerMSFT
authored andcommitted
acrolinx
1 parent 9728d0e commit 5107709

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

docs/standard-library/using-insertion-operators-and-controlling-format.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ int main( )
8787
}
8888
```
8989
90-
The `width` member function is declared in `<iostream>`. If you use `setw` or any other manipulator with arguments, you must include `<iomanip>`. In the output, strings are printed in a field of width 6 and integers in a field of width 10:
90+
The `width` member function is declared in `<iostream>`. If you use `setw` or any other manipulator with arguments, you must include `<iomanip>`. In the output, strings print in a field of width 6 and integers in a field of width 10:
9191
9292
```Output
9393
Zoot 1.23
@@ -96,7 +96,7 @@ The `width` member function is declared in `<iostream>`. If you use `setw` or an
9696
Stan 4358.24
9797
```
9898

99-
Neither `setw` nor `width` truncates values. If formatted output exceeds the width, the entire value prints, subject to the stream's precision setting. Both `setw` and `width` affect the following field only. Field width reverts to its default behavior (the necessary width) after one field has been printed. However, the other stream format options remain in effect until changed.
99+
`setw` and `width` don't truncate values. If formatted output exceeds the width, the entire value prints, subject to the stream's precision setting. Both `setw` and `width` affect the following field only. Field width reverts to its default behavior (the necessary width) after one field has been printed. However, the other stream format options remain in effect until changed.
100100

101101
## <a name="vclrfalignmentanchor4"></a> Alignment
102102

@@ -176,11 +176,11 @@ Again, the program prints one digit after the decimal point. If either `ios::fix
176176

177177
## <a name="vclrfradixanchor6"></a> Radix
178178

179-
The `dec`, `oct`, and `hex` manipulators set the default radix for input and output. For example, if you insert the `hex` manipulator into the output stream, the object correctly translates the internal data representation of integers into a hexadecimal output format. The numbers are displayed with digits a through f in lower case if the [`uppercase`](../standard-library/ios-functions.md#uppercase) flag is clear (the default); otherwise, they are displayed in upper case. The default radix is `dec` (decimal).
179+
The `dec`, `oct`, and `hex` manipulators set the default radix for input and output. For example, if you insert the `hex` manipulator into the output stream, the object correctly translates the internal data representation of integers into a hexadecimal output format. The numbers are displayed with digits a through f in lower case if the [`uppercase`](../standard-library/ios-functions.md#uppercase) flag is clear (the default); otherwise, they're displayed in upper case. The default radix is `dec` (decimal).
180180

181181
## Quoted strings (C++14)
182182

183-
When you insert a string into a stream, you can easily retrieve the same string back by calling the `stringstream::str()` member function. However, if you want to use the extraction operator to insert the stream into a new string at a later point, you may get an unexpected result because the `>>` operator by default will stop when it encounters the first whitespace character.
183+
When you insert a string into a stream, you can easily retrieve the same string back by calling the `stringstream::str()` member function. However, if you want to use the extraction operator to insert the stream into a new string at a later point, you may get an unexpected result because the `>>` operator by default will stop when it finds the first whitespace character.
184184

185185
```cpp
186186
std::stringstream ss;
@@ -194,11 +194,11 @@ std::cout << inserted; // This is a sentence.
194194
std::cout << extracted; // This
195195
```
196196

197-
This behavior can be overcome manually, but to make string round-tripping more convenient, C++14 adds the `std::quoted` stream manipulator in `<iomanip>`. Upon insertion, `quoted()` surrounds the string with a delimiter (double quote ' " ' by default) and upon extraction manipulates the stream to extract all characters until the final delimiter is encountered. Any embedded quotes are escaped with an escape character ('\\\\' by default).
197+
This behavior can be overcome manually, but to make string round-tripping more convenient, C++14 adds the `std::quoted` stream manipulator in `<iomanip>`. Upon insertion, `quoted()` surrounds the string with a delimiter (double quote ' " ' by default) and upon extraction manipulates the stream to extract all characters until the final delimiter is found. Any embedded quotes are escaped with an escape character ('\\\\' by default).
198198

199-
The delimiters are present only in the stream object; they are not present in the extracted string but they are present in the string returned by [`basic_stringstream::str`](../standard-library/basic-stringstream-class.md#str).
199+
The delimiters are present only in the stream object; they aren't present in the extracted string but they're present in the string returned by [`basic_stringstream::str`](../standard-library/basic-stringstream-class.md#str).
200200

201-
The whitespace behavior of the insertion and extraction operations is independent of how a string is represented in code, so the quoted operator is useful regardless of whether the input string is a raw string literal or a regular string. The input string, whatever its format, can have embedded quotes, line breaks, tabs, and so on and all these will be preserved by the `quoted()` manipulator.
201+
The whitespace behavior of the insertion and extraction operations is independent of how a string is represented in code, so the quoted operator is useful regardless of whether the input string is a raw string literal or a regular string. The input string, whatever its format, can have embedded quotes, line breaks, tabs, and so on, and all these will be preserved by the `quoted()` manipulator.
202202

203203
For more information and full code examples, see [`quoted`](../standard-library/iomanip-functions.md#quoted).
204204

0 commit comments

Comments
 (0)