Triggers: Difference between revisions

241 bytes removed ,  19 September 2016
m
no edit summary
mNo edit summary
mNo edit summary
Line 262: Line 262:
; getLineNumber : Get the current line number.
; getLineNumber : Get the current line number.


===Примеры===
=== Examples ===
====Запись и чтение из файла====
==== Writing & reading from a file ====
 
<source lang="javascript" line>
<source lang="javascript" line>
f= file("/sdcard/myfile.txt")
f= file("/sdcard/myfile.txt")
Line 272: Line 273:
var a = file.readLines();
var a = file.readLines();
</source>
</source>
<ol>
<ol>
<li>Открываем файл myfile.txt на sdcard. Если файл еще не существует, то он будет создан.</li>
<li>Open myfile.txt file on the sdcard. If the file does not exist, it is created.</li>
<li>Записываем в файл строку "one"</li>
<li>Write the file into a string "one"</li>
</ol>
</ol>
<ol start="5">
<ol start="5">
<li>Закрываем файл, только после этого файл сохраняется.</li>
<li>Close the file, only then saved the file.</li>
<li>Считываем из файла все строки, в результате получаем массив строк в переменной a.</li>
<li>Read the file from all the rows, the result is an array of strings to a.</li>
</ol>
</ol>


====Сохранить в файл запись====
====Save a file to a record ====
Необходимо сохранить запись в формате xml. Запись имеет следующие поля: id , title , date.  
Необходимо сохранить запись в формате xml. Запись имеет следующие поля: id , title , date.  
<source lang="javascript" line>
<source lang="javascript" line>