Weeding out Hexadecimal IP address

S

Slain

I need to validate to ensure that the user is not entering IP address
in Hexadecimal form. Is there some way to check for it?

The user would probably enter it in 0x form. Hence the only solution
which comes to my mind is to look for 'x' int the string and if so
declare it invalid. Any other ideas?

Thanks
 
V

Victor Bazarov

Slain said:
I need to validate to ensure that the user is not entering IP address
in Hexadecimal form. Is there some way to check for it?

The usual and the simplest way is to try converting and if it fails,
tell the user (and ask to re-enter).
The user would probably enter it in 0x form. Hence the only solution
which comes to my mind is to look for 'x' int the string and if so
declare it invalid. Any other ideas?

I am not sure I grasp your 'x' idea...

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,054
Latest member
LucyCarper

Latest Threads

Top