function Trim(str)
{
//把str首尾的空格去掉
var temp1 = str.replace(/(^\s*)|(\s*$)/g, "");
//把str首尾的单引号去掉
var temp2 = temp1.replace(/(^'*)|('*$)/g, "");
//把str首尾的双引号去掉
var temp3 = temp2.replace(/(^"*)|("*$)/g, "");
return temp3;
}
UltraEdit.activeDocument.bottom(); //跳转到文件结尾。
var num = UltraEdit.activeDocument.currentLineNum; //得到当前行号
UltraEdit.activeDocument.findReplace.regExp = true; //使用正则表达式查找
//UltraEdit.ueReOn(); //将正则表达式切换为符合 UE 样式的正则表达式。
//UltraEdit.unixReOn(); //将正则表达式切换为符合 Unix 样式的正则表达式。
UltraEdit.perlReOn(); //将正则表达式切换为符合 Perl 样式的正则表达式。
var regexpFind = "";
/*
UltraEdit.activeDocument.top();
var x = num ;
while (x>0)
{
UltraEdit.activeDocument.findReplace.find(regexpFind); //查找字符串 str
UltraEdit.activeDocument.selectLine();
line = UltraEdit.activeDocument.selection;
//UltraEdit.messageBox(line);
var line2 = Trim(line)
UltraEdit.document[0].write('db.store.find({"name":"'+line2+'"}).count()'+"\n");
UltraEdit.activeDocument.findReplace.find(regexpFind);
x--;
}
*/
UltraEdit.activeDocument.top();
while(UltraEdit.activeDocument.findReplace.find(regexpFind))
{
UltraEdit.activeDocument.selectLine();
line = UltraEdit.activeDocument.selection;
//UltraEdit.messageBox(line);
var line2 = Trim(line);
UltraEdit.document[0].write('db.store.find({"name":"'+line2+'"}).count()'+"\n");
UltraEdit.activeDocument.findReplace.find(regexpFind);
}
UltraEdit.document[0].write("\n===========\n")
UltraEdit.activeDocument.top();
while(UltraEdit.activeDocument.findReplace.find(regexpFind))
{
UltraEdit.activeDocument.selectLine();
line = UltraEdit.activeDocument.selection;
//UltraEdit.messageBox(line);
var line2 = Trim(line);
UltraEdit.document[0].write('db.store.find({"name":"'+line2+'"},{"name" :1,"subsidiaryFlag":1}).pretty()'+"\n");
UltraEdit.activeDocument.findReplace.find(regexpFind);
}
UltraEdit.document[0].write("\n===========\n")
UltraEdit.activeDocument.top();
while(UltraEdit.activeDocument.findReplace.find(regexpFind))
{
UltraEdit.activeDocument.selectLine();
line = UltraEdit.activeDocument.selection;
//UltraEdit.messageBox(line);
var line2 = Trim(line);
UltraEdit.document[0].write('db.store.update({"name":"'+line2+'"},{$set:{"subsidiaryFlag":"false"}});'+"\n");
UltraEdit.activeDocument.findReplace.find(regexpFind);
}
{
//把str首尾的空格去掉
var temp1 = str.replace(/(^\s*)|(\s*$)/g, "");
//把str首尾的单引号去掉
var temp2 = temp1.replace(/(^'*)|('*$)/g, "");
//把str首尾的双引号去掉
var temp3 = temp2.replace(/(^"*)|("*$)/g, "");
return temp3;
}
UltraEdit.activeDocument.bottom(); //跳转到文件结尾。
var num = UltraEdit.activeDocument.currentLineNum; //得到当前行号
UltraEdit.activeDocument.findReplace.regExp = true; //使用正则表达式查找
//UltraEdit.ueReOn(); //将正则表达式切换为符合 UE 样式的正则表达式。
//UltraEdit.unixReOn(); //将正则表达式切换为符合 Unix 样式的正则表达式。
UltraEdit.perlReOn(); //将正则表达式切换为符合 Perl 样式的正则表达式。
var regexpFind = "";
/*
UltraEdit.activeDocument.top();
var x = num ;
while (x>0)
{
UltraEdit.activeDocument.findReplace.find(regexpFind); //查找字符串 str
UltraEdit.activeDocument.selectLine();
line = UltraEdit.activeDocument.selection;
//UltraEdit.messageBox(line);
var line2 = Trim(line)
UltraEdit.document[0].write('db.store.find({"name":"'+line2+'"}).count()'+"\n");
UltraEdit.activeDocument.findReplace.find(regexpFind);
x--;
}
*/
UltraEdit.activeDocument.top();
while(UltraEdit.activeDocument.findReplace.find(regexpFind))
{
UltraEdit.activeDocument.selectLine();
line = UltraEdit.activeDocument.selection;
//UltraEdit.messageBox(line);
var line2 = Trim(line);
UltraEdit.document[0].write('db.store.find({"name":"'+line2+'"}).count()'+"\n");
UltraEdit.activeDocument.findReplace.find(regexpFind);
}
UltraEdit.document[0].write("\n===========\n")
UltraEdit.activeDocument.top();
while(UltraEdit.activeDocument.findReplace.find(regexpFind))
{
UltraEdit.activeDocument.selectLine();
line = UltraEdit.activeDocument.selection;
//UltraEdit.messageBox(line);
var line2 = Trim(line);
UltraEdit.document[0].write('db.store.find({"name":"'+line2+'"},{"name" :1,"subsidiaryFlag":1}).pretty()'+"\n");
UltraEdit.activeDocument.findReplace.find(regexpFind);
}
UltraEdit.document[0].write("\n===========\n")
UltraEdit.activeDocument.top();
while(UltraEdit.activeDocument.findReplace.find(regexpFind))
{
UltraEdit.activeDocument.selectLine();
line = UltraEdit.activeDocument.selection;
//UltraEdit.messageBox(line);
var line2 = Trim(line);
UltraEdit.document[0].write('db.store.update({"name":"'+line2+'"},{$set:{"subsidiaryFlag":"false"}});'+"\n");
UltraEdit.activeDocument.findReplace.find(regexpFind);
}