DroidScript wiki

(was AndroidScript) unofficial documentation by the community

User Tools

Site Tools


sample_code:sort_list

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

sample_code:sort_list [2014/12/17 16:11] (current)
octazid created
Line 1: Line 1:
 +====== Sort a List ======
 +(Sample Code taken from the DroidScript Google-Group)
 +<code JavaScript sortlist1.js>​
 +  var myList = app.ListFolder( "/​sdcard"​ );
 +  myList.sort(function(x,​y){return (x.toLowerCase() > y.toLowerCase())?​1:​-1} );
 +  Folder = app.CreateList( myList, 1, 0.85);
 +</​code>​
  
 +<code JavaScript sortlist2.js>​
 +var myList = [ "​Fred",​ "​Bill",​ "​Mark",​ "​Jane"​ ];
 +myList.sort();​
 +Names = app.CreateList( myList, 1, 0.85);
 +</​code>​
sample_code/sort_list.txt ยท Last modified: 2014/12/17 16:11 by octazid