Brian Dunning's FileMaker Custom Functions

IP2IPLong ( IP )

Converts IP to IPLong

  Average rating: 4.8 (24 votes) Log in to vote

Dick Impens   Dick Impens - Show more from this author
MaltaCode
https://maltacode.com

Share on Facebook Share on Twitter

  Sample input:
IPLong ( "192.168.0.1" )
  Sample output:
3232235521

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

This function converts a IP address to a IPLong INT, widely used by PHP to save space in a database.

 

Comments

unix   unix, Japan
Sep 30, 2013
We need only one Let function...

Let (
[
string = Substitute ( IP ; "." ; ¶ ) ;
A = GetValue ( string ; 1 ) ;
B = GetValue ( string ; 2 ) ;
C = GetValue ( string ; 3 ) ;
D = GetValue ( string ; 4 )
];
( (a * 256 + b ) * 256 + c ) * 256 + d
)
 
Dick Impens   Dick Impens, MaltaCode
Oct 1, 2013
Thx unix, neat formattig.
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 15 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth:

Under construction. Email me your wish list for improvements.