c# - Check if string contains strictly a string -
I have a string that looks like this: str = P1 | P2 | P3 .... P3 ....
I need to see that the example P1 in the string includes: I do this:
if (str.Contains ("P1")) {...} My problem comes when I am not in P1 and PR1, but P10 gives this right, which is logical But I do not need it, but I do not need it.
If I have P10 in the string then I have not returned the truth.
You can split the string into the array and then this Kindly check
bool bFound = str.split ('|'). Contains ("P1")
Comments
Post a Comment