我有一个关于如何在 Google Script 中使用“字符串”类型的问题?
我有一个包含不同格式站点的专栏,例如
http:// /testsite.com/, http:// /www.sitetest.net/, dot.anothersite.com, http:// /anysite.net/index.html
等等。
所以我想将这些记录自动格式化为一个模板:sitename.domain(例如 http:///testsite.com/=testsite.com||http:///www。 sitetest.net/= sitetest.net)
我通过这个脚本得到这个信息:
var sheet = SpreadsheetApp.getActiveSheet();
var sheetName = sheet.getName();
var restrictSheet = "Summary";
if (sheetName != restrictSheet){ // I don't need to modify first sheet from my spreadsheet
var sheetRange = sheet.getActiveRange();
var sData = sheet.getRange("A3:A"); // column with sites
var TextArray = sData.getValues();
}else Browser.msgBox("wrong sheet");
}
而且我不知道如何在 google 脚本中使用字符串。例如,在 C++ 中,我可以使用字符串函数,如 String.Find() 或 String.Mid()。但是我在 Google Scripts 中看不到相同的功能
最佳答案
嗯......我在我自己的问题上找到了答案:D
Google Script 使用 JavaScript 中的 String 类
所以来自 JS 的函数和方法也适用于 Google Scripts..
http://www.w3schools.com/jsref/jsref_obj_string.asp
可能它会帮助某人。
关于string - 处理字符串的 Google 电子表格脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15071717/