c# - How to check a string contains another string -
this question has answer here:
- how can check if string exists in string 8 answers
i have string of numbers separated commas ,how check if string contained in string .
for example :
if have string :
67,782,452,67632,9,155,323
how check 155
in previous string using linq ?
i assume want check if 1 of items in string given string. split string first delimiter ,
, use contains
or any
:
string[] items = "67,782,452,67632,9,155,323".split(','); bool contains = items.contains("155"); contains = items.any(i => == "155");
the problem contains
-check on string "1550" contain "155".
Comments
Post a Comment