Is there a way I can check Integers if they contain a certain number in C#?
For example: I want to check for 7. When I enter 17, the code
For example:
I want to check for 7. When I enter 17, the code
Convert it to a string, then use String.Contains:
String.Contains
int i = 17; int j = 28 int k = 7; bool a = i.ToString().Contains(k.ToString()); bool b = j.ToString().Contains(k.ToString());
int number = 17; int digit = 7; bool result = number.ToString().Contains(digit.ToString());