首页 > 文档 > saveStrings()保存字符串
2017
08-02

saveStrings()保存字符串

Name

saveStrings()保存字符串

   

Examples

String words = “apple bear cat dog”;

String[] list = split(words, ‘ ‘);

 

// Writes the strings to a file, each on a separate line

saveStrings(“nouns.txt”, list);

Description

Writes an array of Strings to a file, one line per String. By default, this file is saved to the sketch’s folder. This folder is opened by selecting “Show Sketch Folder” from the “Sketch” menu.

Alternatively, the file can be saved to any location on the computer by using an absolute path (something that starts with / on Unix and Linux, or a drive letter on Windows).

Starting with Processing 1.0, all files loaded and saved by the Processing API use UTF-8 encoding. In earlier releases, the default encoding for your platform was used, which causes problems when files are moved to other platforms.

将字符串数组写入文件, 每个字符串中有一行。默认情况下, 此文件保存到草绘的文件夹中。通过从草绘菜单中选择显示草图文件夹打开此文件夹。

 

或者, 该文件可以通过使用绝对路径 ( unix linux 上启动的东西, windows 上的驱动器号) 保存到计算机上的任何位置。

 

从处理1.0 开始, 处理 api 加载和保存的所有文件都使用 UTF-8 编码。在早期版本中, 使用了您的平台的默认编码, 这会导致在将文件移动到其他平台时出现问题。

Syntax

saveStrings(filename, data)

Parameters

filename

String: filename for output

输出的文件名称

data

String[]: string array to be written

 

需要写入的字符串数组

Returns

void

Related

loadStrings()
loadBytes()
saveBytes()



最后编辑:
作者:卡萨布兰卡
这个作者貌似有点懒,什么都没有留下。

留下一个回复

你的email不会被公开。