Google 应用脚本无法使用 .toUppercase() 将变量大写

Google App Script can't capitalise a variable using .toUppercase()

我定义了一个变量:

var capitaliseMe = "this is an example";

我想用这个变量的大写形式替换 Google 文档的 header 中的文本。

我尝试使用以下

header.replaceText("{{ReplaceMe}}", capitaliseMe.toUppercase());

但这似乎不起作用,因为我收到错误

TypeError: capitaliseMe.toUppercase is not a function

在 Stack Overflow 或其他在线网站上似乎没有对此问题的全面解答,因此非常感谢您提供大写方面的帮助!

尝试:

header.replaceText("{{ReplaceMe}}", capitaliseMe.toUpperCase());

C 是大小写未大写。它被称为骆驼代码。

toUpperCase