我有以下解决方案:

var audience = "Nderon Hyseni John Champion Martin Tyler";
var _username = user.get_title(); //This variable show the user that is currently logged in

例:

我使用名为Nderon Hyseni的用户登录,我怎么能说_username(当前登录此用户名Nderon Hyseni)的值是否在audience变量alert("Pass")中,如果不是alert(failed)

谢谢大家!

最佳答案

var audience = "Nderon Hyseni John Champion Martin Tyler";
var _username = user.get_title(); //Nderon Hyseni
if(audience.Contains(_username)){
   //found
} else {
   //not found
}


我已经几个月没有用C#编写代码了,但是应该可以。

编辑
哇... javascript; D

var audience = "Nderon Hyseni John Champion Martin Tyler";
var _username = user.get_title(); //Nderon Hyseni
if(audience.indexOf(_username) > -1){
   //found
} else {
   //not found
}


这应该工作:)

09-20 11:16