1

I have an array with 3 items "AAA", "BBB" & "CCC"

I have a string and its value is "CCC"

I am looking for a condition that will take this string and check if its in the array.

I get the array via:

string[] departmentArray = newDepartment.Split(',');

and the string

string department = "CCC";
0

2 Answers 2

1

String.Contains could well work here.

if (newDepartment.Contains(department)) {
// the substring is in the big one.
}
Sign up to request clarification or add additional context in comments.

Comments

0

Try if (departmentArray.Contains(department)) ...

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.