Hi,
I just wanna know if this is possible
I've a text file with numbers, example
A=10
B=1
C=40
I wanna change these numbers, wanna add or subtract let's say 10% of each number.. is this possible with Ultraedit ?
Thank you.
Welcome to the IDM Forum. This forum is meant as a user-to-user support mechanism where users can share knowledge and tips for all IDM software.
Since these forums are user-to-user based, IDM does not regularly read or reply to the posts in this forum. For problem reports, suggestions, or feature requests, you must email us directly. Our trained technical support staff answers most inquiries within 30 minutes.
// Add a function to String object, that searches for numbers (decimal point = .)
// following an equal sign and multiply each with 1.1 (adds 10%) and round to integer.
String.prototype.addTenPctRound = function(){
return this.replace(/[=]([\d.]+)/,function($0,$1) {
return "="+(Math.round($1 * 1.1));
});
}
var lineno = 1;
UltraEdit.activeDocument.top();
while (! UltraEdit.activeDocument.isEof() ) { /* loop through the file */
UltraEdit.activeDocument.selectLine();
var line = UltraEdit.activeDocument.selection; /* read selection into variable */
UltraEdit.activeDocument.write(line.addTenPctRound()); /* write line back into the editor */
UltraEdit.activeDocument.gotoLine(++lineno,1);
}

