Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Qt_script_ip2int

Paweł Salawa edited this page Apr 13, 2021 · 1 revision

Definition

Language: Qt Script
Plugin for language: ScriptingQt
How to use: Create custom SQL function. Suggested name: ip2int
Function arguments Keep undefined
Function usage: select ip2int('192.168.0.1');
Description: Converts X.X.X.X representation of IPv4 to the integer representation.

Code

The code:

return arguments[0].split('.').reduce(function(ipInt, octet) { return (ipInt<<8) + parseInt(octet, 10)}, 0) >>> 0;

Clone this wiki locally

AltStyle によって変換されたページ (->オリジナル) /