传递给函数的电子邮件文本被解释为类 [英] email text passed to a function is interpreted as a class

查看:41
本文介绍了传递给函数的电子邮件文本被解释为类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将电子邮件地址文本变量传递给函数.

I am passing an email address text variable to a function.

仅当我通过"org"传递文本时.在其中,它被解释为一个类

only when I pass a text with "org." in it, it is interpreted as a class

function main()
{
  var email = "name@surname.org.il";
  receiveemail(email);
}

function receiveemail(email)
{
  Logger.log('received a new email %s', email);
} 

意思是,函数receiveemail中的email变量看起来像这样:

meaning, the email variable in function receiveemail looks like this:

"name@surname.(class)"

然后我尝试将电子邮件作为文本数组传递

then I tried to pass the email as a text array

function main()
{
  var Text = new Array();
  Text[0] = "name@surname.";
  Text[1] = "org.";
  Text[2] = "il";
  receiveemail(Text);
}

得到了:

["name@surname.", "(class)", "il"]

最后,我尝试了这个:

function main()
{
  var Text = new Array();
  Text[0] = "name@surname.";
  Text[1] = "org";
  Text[2] = ".il";
  receiveemail(Text);
} 

得到了:

["name@surname.", "org", ".il"]

因此,很明显"org".被保留了...

So, it's pretty clear that "org." is reserved somehow...

问题是,除了必须将电子邮件地址拆分为文本数组之外,还有一种方法可以避免这种情况,将点放置在正确的位置,以使解释器无法识别组织".作为一个班级?

the question is, is there a way to avoid this, other than having to split the email address into a text array, with the dots placed in the correct position in order for the interpreter not to recognize the "org." as a class?

谢谢

推荐答案

这是一个视觉错误.看起来像某些关键字,例如 org com 在调试控制台中已更改为(class).但是基础字符串不会更改,并且可以按预期工作.

It a visual bug. It just looks like certain keywords like org ,com are changed to (class) in the debug console. But the underlying string is not changed and works as intended.

这篇关于传递给函数的电子邮件文本被解释为类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆