---
title: "StringStream"
author: "Perrin Yong"
author_profile: https://www.pystone.net/profile/
published_by: "Perrin Yong"
canonical: https://www.pystone.net/notes/cpp-stringstream/
type: note
content_role: unspecified
visibility: public
id_stability: rename-stable
source_path: "10-计算机、信息技术与工程/02-编程语言与运行时/C++/StringStream.md"
content_hash: 5e04a88c131412abbee7f4dae26545c16e7c08d7a699abab07eebce3187ec90e
knowledge_version: 224c990773de.5fa8af6e39fa
site_commit: 224c990773de166d23a886306577dd90379529ce
notes_commit: 5fa8af6e39fa3891d1b9b4832bfa6c4e0ecaaf0a
---
# StringStream

﻿# StringStream

> 创建时间：2020/1/22 17:47

![assets/StringStream__Image.png](/media/ec404c60767f18063001.png)

### istringstream

```cpp
string str1 = &quot;test&quot;;
string str2 = &quot;test&quot;;

```

### ostringstream

```cpp
string str1 = &quot;test&quot;;
string str2 = &quot;test&quot;;

```

### stringstream妙用：（以上两个功能都具备）

数据类型转换：

```cpp
string str1 = &quot;test&quot;;
string str2 = &quot;test&quot;;

```

string转double/int:

```cpp
string str1 = &quot;test&quot;;
string str2 = &quot;test&quot;;

```
