This code calls up a lot of custom stuff that won't compile but may be of help to know how to go about it:
Code:bool ValidateIP(string ip) { xVector<string> exploded = Parser::Explode(ip,"."); if(exploded.GetSize()!=4)return false; string tmp; for(int i=0;exploded.Get(tmp,i);i++) { int octet = BitStream::Str2Int(tmp); if(octet<0 || octet>255)return false; } return true; }
Basically you want to explode the string by ".", then make sure that all you have is 4 ints, and that they are between 0 and 255.




Reply With Quote