Warning: preg_match(): Compilation failed: group name must start with a non-digit at offset 8 in /home/jwatt/editplus.info/w/includes/MagicWord.php on line 860

Warning: preg_match(): Compilation failed: group name must start with a non-digit at offset 8 in /home/jwatt/editplus.info/w/includes/MagicWord.php on line 860

Warning: preg_match_all(): Compilation failed: group name must start with a non-digit at offset 4 in /home/jwatt/editplus.info/w/includes/MagicWord.php on line 834

Warning: Invalid argument supplied for foreach() in /home/jwatt/editplus.info/w/includes/MagicWord.php on line 835

Warning: preg_replace(): Compilation failed: group name must start with a non-digit at offset 4 in /home/jwatt/editplus.info/w/includes/MagicWord.php on line 839

Warning: preg_match_all(): Compilation failed: group name must start with a non-digit at offset 4 in /home/jwatt/editplus.info/w/includes/MagicWord.php on line 834

Warning: Invalid argument supplied for foreach() in /home/jwatt/editplus.info/w/includes/MagicWord.php on line 835

Warning: preg_replace(): Compilation failed: group name must start with a non-digit at offset 4 in /home/jwatt/editplus.info/w/includes/MagicWord.php on line 839

Warning: preg_match_all(): Compilation failed: group name must start with a non-digit at offset 4 in /home/jwatt/editplus.info/w/includes/MagicWord.php on line 834

Warning: Invalid argument supplied for foreach() in /home/jwatt/editplus.info/w/includes/MagicWord.php on line 835

Warning: preg_replace(): Compilation failed: group name must start with a non-digit at offset 4 in /home/jwatt/editplus.info/w/includes/MagicWord.php on line 839

Warning: preg_match_all(): Compilation failed: group name must start with a non-digit at offset 4 in /home/jwatt/editplus.info/w/includes/MagicWord.php on line 834

Warning: Invalid argument supplied for foreach() in /home/jwatt/editplus.info/w/includes/MagicWord.php on line 835

Warning: preg_replace(): Compilation failed: group name must start with a non-digit at offset 4 in /home/jwatt/editplus.info/w/includes/MagicWord.php on line 839

Warning: preg_match(): Compilation failed: group name must start with a non-digit at offset 8 in /home/jwatt/editplus.info/w/includes/MagicWord.php on line 860

Warning: preg_match(): Compilation failed: group name must start with a non-digit at offset 8 in /home/jwatt/editplus.info/w/includes/MagicWord.php on line 860

Warning: preg_match(): Compilation failed: group name must start with a non-digit at offset 8 in /home/jwatt/editplus.info/w/includes/MagicWord.php on line 860

Warning: preg_match(): Compilation failed: group name must start with a non-digit at offset 8 in /home/jwatt/editplus.info/w/includes/MagicWord.php on line 860
User Tools - EditPlus Wiki

User Tools

Jump to: navigation, search
m (Full RegEx Supported Replace and More!)
(XML Beautifier)
Line 1,533: Line 1,533:
 
stdout.Write(xml.xml.substr(0, xml.xml.length-2));
 
stdout.Write(xml.xml.substr(0, xml.xml.length-2));
 
</pre>
 
</pre>
 +
 +
===Transpose Array===
 +
Description: Swap rows for columns in tab-separated text.  Great for use with a spreadsheet.<br>
 +
Author: jimbo<br>
 +
Command: <tt>cscript //NoLogo "c:\path to file\file.js"</tt><br>
 +
Check: "Run as text filter"<br>
 +
Example:
 +
<pre>
 +
Input:
 +
======
 +
a b c
 +
1 2 3 4
 +
alpha beta gamma
 +
======
 +
 +
Output:
 +
======
 +
a 1 alpha
 +
b 2 beta
 +
c 3 gamma
 +
4
 +
======
 +
</pre>
 +
Code:
 +
<pre>
 +
var stdin  = WScript.StdIn;
 +
var stdout = WScript.StdOut;
 +
 +
var text  = stdin.ReadAll();
 +
var lines = text.split(/\s*\n/g);
 +
var maxcols = lines.length-1;
 +
var maxrows=0;
 +
var line,parts=[], part,out;
 +
 +
// split it out and size it up
 +
for (var i=0;i<lines.length;i++) {
 +
parts[i] = lines[i].split('\t');
 +
maxrows = Math.max(maxrows,parts[i].length);
 +
}
 +
 +
// spit it back out
 +
for (var i=0;i<=maxrows;i++) {
 +
out = '';
 +
for (var j=0;j<=maxcols;j++) { out += ( parts[j][i] || '' )+'\t' }
 +
// trim trailing tabs
 +
stdout.Write(out.replace(/\t+$/,''));
 +
// don't write an extra newline
 +
if (i<=maxrows-1) { stdout.Write('\n') }
 +
}
 +
</pre>
 +
 +
===Natural Sort===
 +
Description: .<br>
 +
Author: jimbo<br>
 +
Command: <tt>cscript //NoLogo "c:\path to file\file.js"</tt><br>
 +
Check: "Run as text filter"<br>
 +
Get File: Get and save javascript natcompare.js via http://sourcefrog.net/projects/natsort/ to whatever directory this script
 +
is in.<br>
 +
Example:
 +
<pre>
 +
Input:
 +
======
 +
04-08-10
 +
04-1-15
 +
05-1-1
 +
======
 +
 +
Output:
 +
======
 +
04-1-15
 +
04-08-10
 +
05-1-1
 +
======
 +
 +
Input:
 +
======
 +
id10TFier.v1.10
 +
id10TFier.v1.10.1
 +
id10TFier.v1.9.3
 +
======
 +
 +
Output:
 +
======
 +
id10TFier.v1.9.3
 +
id10TFier.v1.10
 +
id10TFier.v1.10.1
 +
======
 +
</pre>
 +
Code:
 +
<pre>
 +
var stdin  = WScript.StdIn;
 +
var stdout = WScript.StdOut;
 +
 +
eval(new ActiveXObject("Scripting.FileSystemObject").OpenTextFile("natcompare.js",1).ReadAll());
 +
 +
var text  = stdin.ReadAll();
 +
var lines = text.split(/\s*\n/g);
 +
 +
stdout.Write(lines.sort(natcompare).join('\n'));
 +
</pre>
 +
 
===Alternate Function List With JS===
 
===Alternate Function List With JS===
 
Description: It show function list like "Search in files" command: You can see the line number, and click it on.<br>
 
Description: It show function list like "Search in files" command: You can see the line number, and click it on.<br>

Revision as of 04:56, 3 November 2011

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox