IsLocalHost
Determine whether a given string value represents a loopback IP address, like localhost, 127.0.0.1 or ::1.
Method Signature
IsLocalHost(ip=[string])Arguments
Argument
Type
Required
Description
Default
ip
string
true
String representing the IP address to test.
Examples
Is 127.0.0.1 localhost
isLocalHost( "127.0.0.1" );
Result: true
Is ::1 localhost
Test the IPv6 Loopback address. IPv6 only has one loopback address.
Result: true
Is 127.8.8.8 localhost
IPv4 network standards reserve the entire 127.0.0.0/8 address block for loopback networking purposes however they are not usually mapped to localhost by default.
Result: true
Is 8.8.8.8 localhost
Not a localhost IP.
Result: false
Additional Examples
Related
Last updated
Was this helpful?
