Google apps script 谷歌应用程序脚本:如何从textArea获取文本?(替换文本)
我需要替换文本区域中的文本,我做错了什么Google apps script 谷歌应用程序脚本:如何从textArea获取文本?(替换文本),google-apps-script,textarea,Google Apps Script,Textarea,我需要替换文本区域中的文本,我做错了什么 function doGet() { var app = UiApp.createApplication(); var textArea = app.createTextArea() .setText('here is text... here is text... here is text...') .setName('theText').setId('theText') .addClickHandler(app.createSer
function doGet() {
var app = UiApp.createApplication();
var textArea = app.createTextArea()
.setText('here is text... here is text... here is text...')
.setName('theText').setId('theText')
.addClickHandler(app.createServerHandler('processing'));
app.add(textArea);
return app;
}
function processing(e) {
Logger.log(e.parameter.theText); // In Log I see: 'here is text... here is text... here is text...'
var textIn = e.parameter.theText;
var textOut = textIn.replaceText('/[text]/', 'new text'); // Here I get error: Unable to find a function replaseText in the object here is text... here is text... here is text....
var app = UiApp.getActiveApplication();
app.getElementById('theText').setText(textOut);
return app;
}
我用“e.parameter.theText”尝试了getText、getBody、editAsText等,但结果相同。
错误在哪里?替换方法是简单的
replace
,而不是replaceText
,这是纯粹的
您似乎混淆了Javascript和Javascript字符串操作