I have a question about how to work with 'string' type in Google Script?
I have a column with sites in different formats, e.g. http://testsite.com/, http://www.sitetest.net/, dot.anothersite.com, http://anysite.net/index.html and so on.
So I want to automatically format these records to one template: sitename.domain (for example http://testsite.com/ = testsite.com || http://www.sitetest.net/ = sitetest.net)
I get this info by this script:
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");
}
And I don't know how to work with strings in google script. In C++, for example, I could use string functions like String.Find() or String.Mid(). But I can't see equal functions in Google Scripts
Well... I've found the answer on my own question :D
Google Script uses String class from JavaScript So functions and methods from JS works also in Google Scripts..
http://www.w3schools.com/jsref/jsref_obj_string.asp
May be it will help somebody.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With