Differences

This shows you the differences between two versions of the page.

Link to this comparison view

autoidcheckvalidip [2014/10/26 01:52] (current)
Line 1: Line 1:
 +== Autoit function to Check if an ip address is valid or not ==
 +<​code>​
 +# IsValidIp.au3
 +
 +#include <​Logging.au3>​
 +
 +Func IsValidIp($ip)
 +
 + $isValid = 1
 + # check using RegExp
 + Dim $octets[4]
 + $octets = StringRegExp($ip,​ "​(\d+).(\d+).(\d+).(\d+)",​1)
 + if isArray($octets) then
 + llog(@ScriptName,​ @ScriptLineNumber,​ $octets[0])
 + llog(@ScriptName,​ @ScriptLineNumber,​ $octets[1])
 + llog(@ScriptName,​ @ScriptLineNumber,​ $octets[2])
 + llog(@ScriptName,​ @ScriptLineNumber,​ $octets[3])
 + for $i= 0 to 3
 + if $octets[$i] < 0 or $octets[$i] > 255 then
 + $isValid = 0
 + endif
 + next
 + else
 + $isValid = 0
 + llog(@ScriptName,​ @ScriptLineNumber,​ $ip & " isNot a valid ip")
 + endif
 + Llog(@ScriptName,​ @ScriptLineNumber,​ $ip & " is valid:"​ & $isValid)
 + return $isValid
 +
 +EndFunc
 +</​code>​
 +
 +----
 +
 +  * [[autoit3|Back to AutoIt3]]
  
autoidcheckvalidip.txt ยท Last modified: 2014/10/26 01:52 (external edit)
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0