scripting@wanadoo.nl




TrimIP()

http://www.scriptlogic.com/kixtart/FunctionLibrary_FunctionList.aspx


actual FunctionLibrary list on 'Scriptlogic' site printer-friendly mirror of UDF topic on 'scripting@wanadoo.nl' site close
6 April 2002 TrimIP()
AuthorBrian Petersen
Action This function returns a valid IP address trimmed for spaces.
SyntaxTrimIP (IPaddress) 
Parameters
  • IPaddress (Required / String) Can be @IPADDRESS0 etc. 
  • RemarksAn IP-address is a 32 bit address, written as 4 octets seperated by dots (dot notation). 169.54.88.1 and 169.054.088.001 are the same address.
    If an IP address contains 1 og 2 digit numbers, they have to be written that way or patched up with 0 or 00. An IP address can not contain blanks.

    The problem with the KiXtart Macro @IPADDRESSx is that it returns the IP address as a string containing four octets of 3 characters seperated by dots. IP addresses containing 1 and 2 digits are patched with blanks, so it has to be trimmed. 
    ReturnsThis function returns a valid IP address trimmed for spaces 
    DependenciesNone. 
    Examples
    $CleanIP=TrimIP(@IPaddress0)
    ? "Your IP address is: "+$CleanIP
    
    or simply...
    
    ? "Your IP address is: "+TrimIP(@IPaddress0)
    
     
    Source
    FUNCTION TrimIP ($ipaddress)
      $ip1 = Ltrim(Substr($ipaddress, 1, 3))
      $ip2 = Ltrim(Substr($ipaddress, 5, 3))
      $ip3 = Ltrim(Substr($ipaddress, 9, 3))
      $ip4 = Ltrim(Substr($ipaddress, 13, 3))
      $trimip = $ip1+"."+$ip2+"."+$ip3+"."+$ip4
    ENDFUNCTION ; - TrimIP -
     
      original source of UDF topic. show actual FunctionLibrary list on Scriptlogic site close top
              printer-friendly mirror of UDF topic on scripting@wanadoo.nl site  




    Copyright © 2003 www.scriptlogic.com & scripting@wanadoo.nl - last updated on 20 May 2003


    Site Meter