dcsimg
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Tip: Check Whether or Not an IP Is Valid in C#

Learn more about a short function that validates a given IP address.


advertisement

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


See below for a short function that validates a given IP address:

public static Boolean ValidateIP(string inputIP)

{

var ipParts = inputIP.Split('.');

return Int32.Parse(ipParts [0]) < 256 &&

Int32.Parse(ipParts [1]) < 256&

Int32.Parse(ipParts [2]) < 256 &

Int32.Parse(ipParts [3]) < 256;

}

 

Visit the DevX Tip Bank

 





   
Srinath M. S. says: "I would love to leave a footprint in this flat world."
Thanks for your registration, follow us on our social networks to keep up-to-date