Search Pattern Error since Google Scripts V8 Update

前端 未结 2 845
遇见更好的自我
遇见更好的自我 2021-01-25 07:31

Ever since google forced the update \"This project is running on our new Apps Script runtime powered by Chrome V8.\" I\'m getting the following error and I don\'t understand why

相关标签:
2条回答
  • 2021-01-25 08:03

    I figured it out. It was the empty parts of the string as someone above suggested.

    Thanks!

    0 讨论(0)
  • 2021-01-25 08:05

    Possible cause(s):

    • Your original rhino script is buggy, because it doesn't check the type of the argument fields[0][i] and newData[0][i].

    • Empty string "" and null also throw this error.

    Solution:

    • Cast type and check length of the argument before feeding it to replaceText()

    Snippet:

    if (String(fields[0][i]).length){
      newBody.replaceText(String(fields[0][i]), String(newData[0][i]));
    }
    
    0 讨论(0)
提交回复
热议问题