ExportString[expr,"format"]
用来生成与 expr 对应的以指定格式输出的字符串.
ExportString[rules,{"format","Rules"}]
给出输出数据的不同元素的明确规则.
ExportString[exprs,elems]
产生一个字符串,将 exprs 视为 elems 指定的元素输出.
ExportString
所有格式的列表 »ExportString[expr,"format"]
用来生成与 expr 对应的以指定格式输出的字符串.
ExportString[rules,{"format","Rules"}]
给出输出数据的不同元素的明确规则.
ExportString[exprs,elems]
产生一个字符串,将 exprs 视为 elems 指定的元素输出.
更多信息
- ExportString 生成与用指定格式导出的数据对应的字符串.
- ExportString 处理大量格式,每种类型都可以设置不同类型的可能元素. 列表中给出的可能格式是 $ExportFormats,以及 "所有格式的列表" 中描述的.
- ExportString 的作用类似 Export,有同样的元素规范和选项.
- 许多图形、声音和二进制格式产生包含非输出字符的字符串.
范例
打开所有单元 关闭所有单元基本范例 (2)
范围 (4)
将数组导出为 "CSV" 字符串:
ExportString[{{1, "one"}, {2, "two"}}, "CSV"]将同一数组导出为 "JSON" 字符串:
ExportString[{{1, "one"}, {2, "two"}}, "JSON"]将图形导出为 "Graph6" 字符串:
ExportString[HypercubeGraph[3], "Graph6"]ExportString[HypercubeGraph[3], "Graph6", "Header" -> False]将多个图形导出为 "Graph6" 字符串:
ExportString[Table[HypercubeGraph[n], {n, 0, 4}], "Graph6", "Header" -> False]ExportString[[image], "GIF"]//InputFormFullForm[%]用 "Rules" 语法导出包含多个子元素的 "ZIP" 文件:
zipData = ExportString[ <|"a.gif" -> \!\(\*GraphicsBox[«3»]\), "b.txt" -> "earth seen from space"|>, {"ZIP", "Rules"} ];ImportString[zipData]zipData = ExportString[{\!\(\*GraphicsBox[«3»]\), "earth seen from space"}, {"ZIP", {"a.gif", "b.txt" }}];ImportString[zipData]相关指南
-
▪
- 导入和导出 ▪
- 表达式和字符串间的转换 ▪
- 字符串操作 ▪
- 字符串运算 ▪
- XML 格式 ▪
- 网络编程 ▪
- 导入和导出数据库格式 ▪
- 字符运算 ▪
- 外部已诠释的语言接口
相关链接
历史
1999年引入 (4.0) | 在以下年份被更新:2003 (5.0) ▪ 2004 (5.1) ▪ 2007 (6.0)
文本
Wolfram Research (1999),ExportString,Wolfram 语言函数,https://reference.wolfram.com/language/ref/ExportString.html (更新于 2007 年).
CMS
Wolfram 语言. 1999. "ExportString." Wolfram 语言与系统参考资料中心. Wolfram Research. 最新版本 2007. https://reference.wolfram.com/language/ref/ExportString.html.
APA
Wolfram 语言. (1999). ExportString. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/ExportString.html 年
BibTeX
@misc{reference.wolfram_2026_exportstring, author="Wolfram Research", title="{ExportString}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/ExportString.html}", note=[Accessed: 12-September-2026]}
BibLaTeX
@online{reference.wolfram_2026_exportstring, organization={Wolfram Research}, title={ExportString}, year={2007}, url={https://reference.wolfram.com/language/ref/ExportString.html}, note=[Accessed: 12-September-2026]}