Discover convert ip address to integer, include the articles, news, trends, analysis and practical advice about convert ip address to integer on alibabacloud.com
This article describes how to use Python to easily convert IP addresses between integers and strings, this article also shares with you how to use regular expressions in Python to verify whether a string is an IP address. For more information, see
IP Address | Convert
IP address to Long integer converts a string IP address ("192.168.0.1") to a Long number (3232235521). One of the reasons to does this would is to store IP addresses in databases. Numbers greatly reduce the size required to
First of all, we need to understand the IP address conversion to the integral type (strictly speaking is a long integer) the principle of ~
"Principle of conversion": assuming the IP is: w.x.y.z, the IP address to the integer number of the
IP conversion into integer storage is a major trend of database optimization, many people are still using the storage of IP string type storage, the string index than the whole index consumes a lot of resources, especially in the table of large
Key technologies:
The key technical points for converting an IP address to an integer are as follows:1. Locate the "." position in the IP string using the string indexof Method2. Use the string substring method to divide the IP string into four
The two statements we see in the voting filter: String ip = request. getRemoteAddr (); and long ipnum = StringHandler. getIpNum (ip); the first one is to obtain the ip address of the client, and the second statement is to convert the obtained ip
Java ip address to grow integer method, java integer
Java ip address to growth integer Method
The Code is as follows:
/*** Convert the IP address to an integer * @ param ip * @ return */public static Long ip2int (String ip) {Long num = 0L; if (ip =
The Java IP address is converted to a long integer;Public class util {/*** Convert string IP address to long* @ Param string IP Address
* Weighted by the Left shift operation, the right of the first segment is the 24 power of 2,The second segment
How to convert a JAVA long integer to an IP address
How to convert a JAVA long integer to an IP address
The Code is as follows:
/*** Resolve an integer to an IP address * @ param num * @ return */public static String int2iP (Long num) {String
This article describes how to convert an IP address to an integer in python. it involves the IP address conversion technique in Python, for more information about how to convert an IP address to an integer in python, see the following example. Share
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.