Saves an Array
of String
s to a file, one per line.
The first parameter, list
, is an array with the strings to save.
The second parameter, filename
, is a string that sets the file's name. For example, calling saveStrings(['0', '01', '011'], 'data.txt')
saves the array ['0', '01', '011']
to a file called data.txt
on the user's computer.
The third parameter, extension
, is optional. If a string is passed, as in saveStrings(['0', '01', '0
1'], 'data', 'txt')`, the second parameter will be interpreted as the file name and the third parameter as the extension.
The fourth parameter, isCRLF
, is also optional, If true
is passed, as in saveStrings(['0', '01', '011'], 'data', 'txt', true)
, then two characters, \r\n
, will be added to the end of each string to create new lines in the saved file. \r
is a carriage return (CR) and \n
is a line feed (LF). By default, only \n
(line feed) is added to each string in order to create new lines.
Note: The browser will either save the file immediately or prompt the user with a dialogue window.
उदाहरण
सिंटैक्स
saveStrings(list, filename, [extension], [isCRLF])
पैरामीटर्स
data to save.
name of file to be saved.
format to use for the file.
whether to add \r\n
to the end of each string. Defaults to false
.