Combining Strings

烈酒焚心 提交于 2019-12-11 14:47:17

问题


I am new to Google Apps Script and am trying to combine a series of strings. I have two strings that need to go before and after an inputted cell.

if B4 = "string2" the result of the following line should be "string1 string2 string3" . "string1 " + "B4" + " string3"

String1 and string3 will always be the same so I can set them each to a variable, but I don't know how to concatenate them together. They need to be combined and outputted to a cell in Sheets.

Any help would be greatly appreciated.


回答1:


Strings are very easy to assemble in JavaScript, simply add them using +

From your example :

"string1"+" "+string2+" "+"string3"

Alternatively you can use the .concat method that does exactly the same.



来源:https://stackoverflow.com/questions/26888885/combining-strings

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!