PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, July 21, 2022

[FIXED] How to check if an integer includes a certain number in c#

 July 21, 2022     c#, int, integer, numbers     No comments   

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)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing