我写的基本聊天程序有几个关键词,可以生成特殊动作,图像,消息等.我将所有关键词和特殊函数存储在HashMap中.关键词是键,功能是值.我想将用户输入与键与某种类型的循环进行比较.我已经尝试了我能想到的一切,但没有任何作用.这是我可以弄清楚的:
myHashMap = <File Input>
for(String currentKey : <List of HashMap Keys>){
if(user.getInput().equalsIgnoreCase(currentKey)){
//Do related Value action
}
}
...
Run Code Online (Sandbox Code Playgroud)
我将不胜感激任何帮助.如果我忽略了类似的问题,或者答案是否明显,请原谅我.
我需要一种方法来使用perl脚本来查找自己的pid并使用system命令自行终止.在代码中:
my $pid = &getScriptPID();
system("taskkill $pid");
Run Code Online (Sandbox Code Playgroud)
反正有没有这样做?