Issue
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 will return 1. When I enter 28, the code will return 0.
Thank You
Solution
int number = 17;
int digit = 7;
bool result = number.ToString().Contains(digit.ToString());
Answered By - Jakub Lortz Answer Checked By - Marie Seifert (PHPFixing Admin)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.