Home page  
Help >
CalcObject Function _extractIP()
Version 7.11
CalcObject Function _extractIP() CalcObject Function _extractIP()

_ExtractIP() is a string-valued function that parses an arbitrary string and extracts the first IP Address (if any) from the string.

    Syntax is
      _ExtractIP(<string>,0)
         <string> is the string to be tested.
The input string is first parsed into sub strings based on the break
string " \t()[]:,/@-="; then each sub string is parsed as follows:
   . Remove all leading non-numeric characters;
   . Parse the remainder of the string for [0-9]*.[0-9]*.[0-9]*.[0*9]*
   . Remove all trailing character after the first non-numeric/non-dot
   . If this result is non null, it becomes the result of the function; 
   . else, continue processing sub-strings

A sample procedure using this function is:

   FILL A DATA
   CREATECALCOBJECT CalcObject1 A DATA NULL "RETURN //
                                             SET INPUTSTRING = MESSAGE //
                                             SET RESULT = _extractip(INPUTSTRING,0)  //
                                             IF RESULT NE ' ' //
                                                REWRITE DATA IPADDR = RESULT //
                                             ENDIF //
   GETCALC A DATA NULL CalcObject1

   The timings that I have for 650K input records are:
      Calculate [and read] only:      0:16   [minutes seconds]
      Calculate and write             0:28
      

Copyright © 2019 , WhamTech, Inc.  All rights reserved. This document is provided for information purposes only and the contents hereof are subject to change without notice. Names may be trademarks of their respective owners.