Static p5_sys::global::saveStrings[][src]

pub static saveStrings: SaveStringsInternalType
Expand description

Writes an array of Strings to a text file, one line per String. The file saving process and location of the saved file will vary between web browsers.

Examples

 let words = 'apple bear cat dog';

 // .split() outputs an Array
 let list = split(words, ' ');

 function setup() {
 createCanvas(100, 100);
 background(200);
 text('click here to save', 10, 10, 70, 80);
 }

 function mousePressed() {
 if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {
   saveStrings(list, 'nouns.txt');
 }
 }

 // Saves the following to a file called 'nouns.txt':
 //
 // apple
 // bear
 // cat
 // dog

Parameters

list string array to be written

filename filename for output

extension? the filename’s extension

isCRLF? if true, change line-break to CRLF