Search
 
SCRIPT & CODE EXAMPLE
 

TYPESCRIPT

ips in range typescript


// Returns the number of ips between ip1 and ip2
function ipsInRange(ip1: string, ip2: string): number {

  const ip1Bin: string = ip1.split('.').map((p) => parseInt(p).toString(2).padStart(8, '0')).join('');
  const ip2Bin: string = ip2.split('.').map((p) => parseInt(p).toString(2).padStart(8, '0')).join('');

  return parseInt(ip2Bin, 2) - parseInt(ip1Bin, 2);
}
Comment

PREVIOUS NEXT
Code Example
Typescript :: deleting a comnent from arrays of comments in mongodb 
Typescript :: TYPESCRIPT PIPLINE FOR THE MULTIPLE TYPE 
Typescript :: that asks for a two digit number and then prints the english word for the number 
Typescript :: typescript reset class properties to default 
Typescript :: Access - Open form non data entry mode 
Typescript :: $clients = User::query()-where("type","client" ) 
Typescript :: reach router path typescript error 
Typescript :: modify objects using dot notation 
Typescript :: Name all the elements of set Red. Use the proper set notation. 
Typescript :: nunjucks if logical or 
Typescript :: gets syntax 
Typescript :: current and measurement physics formula 
Typescript :: typescript style guide 
Typescript :: combine 2 lists to dataframe python 
Typescript :: whats a company letterhead 
Typescript :: apexcharts dataURI style 
Typescript :: unity destroy all objects with tag 
Cpp :: howt o initialize 3d vector in c++ 
Cpp :: sfml local mouse position 
Cpp :: underline in latex 
Cpp :: c++ lambda thread example 
Cpp :: c++ pause program 
Cpp :: string to size_t cpp 
Cpp :: compute the average of an array c++ 
Cpp :: c++ random between two values 
Cpp :: C++ Area of Scalene Triangle 
Cpp :: unknown type name pid_t 
Cpp :: certificate exe application 
Cpp :: call of overloaded ‘swap(int&, int&)’ is ambiguous 
Cpp :: initialize all elements of vector to 0 c++ 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =