String contains another two strings

前端 未结 17 1548
故里飘歌
故里飘歌 2020-12-15 07:12

Is it possible to have the contain function find if the string contains 2 words or more? This is what I\'m trying to do:

string d = \"You hit someone for 50          


        
17条回答
  •  南方客
    南方客 (楼主)
    2020-12-15 07:29

    With the code d.Contains(b + a) you check if "You hit someone for 50 damage" contains "someonedamage". And this (i guess) you don't want.

    The + concats the two string of b and a.

    You have to check it by

    if(d.Contains(b) && d.Contains(a))
    

提交回复
热议问题