C# 检查IRC中的等级

C# 检查IRC中的等级,c#,irc,C#,Irc,出于某种原因,它不适用于@,但适用于+级别。我不知道如何检查IRC中的排名 是否有更可靠/有效的方法来检查IRC中的等级 谢谢你的阅读 编辑:它有时并不总是适用于某些人的用户名/昵称。例如:@Oh\u Herro\u Der无法使用该命令。您需要将每个&条件括在括号内 write("NAMES " + channel, writer);//build list of people in channel String[] Users = reader.ReadLine().Split(' ');/

出于某种原因,它不适用于
@
,但适用于
+
级别。我不知道如何检查IRC中的排名

是否有更可靠/有效的方法来检查IRC中的等级

谢谢你的阅读


编辑:它有时并不总是适用于某些人的用户名/昵称。例如:
@Oh\u Herro\u Der
无法使用该命令。

您需要将每个
&
条件括在括号内

write("NAMES " + channel, writer);//build list of people in channel
String[] Users = reader.ReadLine().Split(' ');//read the line from NAMES, and split into Users array
String[] sender = nick.Split('!');//Person calling the bot
string[] args = data.Split('-');//Arguments to command (Not listed)
nick = sender[0].Substring(1);//Person callin the bot as above
foreach (string i in Users)
{
    if (i.StartsWith("+") && i.EndsWith(nick) || i.StartsWith("%") && i.EndsWith(nick) || i.StartsWith("@") && i.EndsWith(nick) || i.StartsWith("&") && i.EndsWith(nick) || i.StartsWith("~") && i.EndsWith(nick))
    {
        Roll_Args(nick, args[1], args[2]);//If above is correct, roll the the command
    }
}

你认为
i.Contains(nick)
会比EndsWith更合适吗?也谢谢你的关注。我不知道它们不是封闭的@凯尔:我不能回答你的第一个问题;那完全取决于你。在任何情况下,如果这解决了您的问题,请记住单击复选标记。
if (i.StartsWith("+") && i.EndsWith(nick)) 
|| (i.StartsWith("%") && i.EndsWith(nick)) 
|| (i.StartsWith("@") && i.EndsWith(nick)) 
|| (i.StartsWith("&") && i.EndsWith(nick)) 
|| (i.StartsWith("~") && i.EndsWith(nick)))
{
    Roll_Args(nick, args[1], args[2]);//If above is correct, roll the the command
}