🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #1723

Re: [JS] Sorting an array and removing duplicates

#1723
From: Peter Kahrel
Date: Wed, 28 Jan 2009 02:20
21 lines
931 bytes

sort_pages (array)

function sort_pages (array) 
   { 
   var str = array.sort (sortnum).join ('\r')+'\r'; 
   str = str.replace (/([^\r]+\r)(\1)+/g,'$1'); 
   str = str.replace (/\r$/,''); 
   str = str.split ('\r'); 
   return str 
   }

function sortnum (a, b) 
   { 
   return a > b 
   }



Peter
Technical Details
Message-ID: <59b7b48e.0@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!newshub.sdsu.edu!webcrossing
References: <59b7b48e.-1@webcrossing.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,92931f0add842eac
X-Google-Attributes: gidf939a,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Peter Kahrel" <kahrel@kahrel.plus.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!newshub.sdsu.edu!webcrossing
Newsgroups: adobe.scripting.indesign
Subject: Re: [JS] Sorting an array and removing duplicates
Message-ID: <59b7b48e.0@webcrossing.la2eafNXanI>
Date: Tue, 27 Jan 2009 18:20:52 -0800
References: <59b7b48e.-1@webcrossing.la2eafNXanI>
Lines: 17
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit