使用了Contains 函式的聊天機械人

2022-04-28 23:42:19 字數 552 閱讀 3842

學習了 傳智播客 聊天機械人的原理,自己寫了個聊天機械人

using system;

using system.collections.generic;

using system.linq;

using system.text;

namespace 控制台基礎聯絡

else if (food > 10)

fulllevel = fulllevel + food;

console.writeline("你喂我吃了{0}個包子,我可以繼續聊天了。", food);

continue;

}if (str.contains("北京"))

else if (str.contains("姓名") || str.contains("名字"))

else if (str.contains("女朋友"))

else if (str.contains("88") || str.contains("再見"))

else

fulllevel--;}}

}}

關於contains 使用的注意

在使用 contains 判斷集合中是否有此物件的時候,需要重寫比較物件的equals方法 把需要比較的字段寫入比較 本博文主要介紹的是contains關於物件的比較 例子 list使用contains。例子 public static void main string args 下面是重寫 ind...

Oracle 中 CONTAINS 函式的用法

select student id,student name from students where contains address,beijing remark beijing是乙個單詞,要用單引號括起來。select student id,student namefrom students w...

Oracle 中Contains 函式的用法

1.查詢住址在北京的學生 select student id,student name from students where contains addregiskmxtnss,beijing remark beijing是乙個單詞,要用單引號括起來。2.查詢住址在河北省的學生 select stu...