>  Docs Center  >  Libraries  >  JHU/APL/S1R  >  TXT_KEYSECTION

TXT_KEYSECTION

TXT_KEYSECTION

Name


      TXT_KEYSECTION

Purpose


      Extract a section of a text array between given keys.

Category


Calling Sequence


      txt_keysection, txt

Inputs


Keyword Parameters


Keywords


        OUT=txt2 Return section in txt2. Using this keyword
          the original array, txt, is not modified.
        AFTER=k1 Section to extract starts after this key.
          Uses first match found.
        BEFORE=k2 Section to extract ends before this key.
          A key is text that matches an element of txt.
          Uses first match after the first AFTER key.
        INDICES=ind Returned indices of matched keys.
          The matched keys are not returned by OUT=txt.
        /MATCH_CASE means match case, else case is ignored.
        /INVERSE Return all lines but the section between
          the AFTER and BEFORE keys (keys not included).
              Or
        INVERSE=itxt Section lines returned in txt or txt2,
          and the remaining lines returned in itxt.
          So one call returns both section lines and all the rest.
        COUNT=cnt Number of elements returned.
        /QUIET inhibit some error messages.
        ERROR=err Error flag: 0=ok.

Outputs


      txt = Text array to modify. in, out

Common Blocks


Notes


      Notes: The text array txt is modified if the given
      keys are found. An example. Let txt be:
        Line 1
        Line 2
        Line 3
        <windows_start>
        Line 4
        Line 5
        Line 6
        <windows_end>
        Line 7
      txt_keysection,txt,after='<windows_start>', $
        before='<windows_end>'
        Returns lines 4,5,6.
      txt_keysection,txt,after='<windows_start>', $
        before='<windows_end>',/inverse
        Returns lines 1,2,3,7.
      txt_keysection,txt,after='<windows_start>', $
        before='<windows_end>',inverse=txt2
        Returns lines 4,5,6 in txt, lines 1,2,3,7 in txt2.

Modification History


      R. Sterner, 2006 Sep 06
      R. Sterner, 2008 Jan 21 --- Added OUT=txt2.
      R. Sterner, 2008 Oct 21 --- Allowed null section (but count=0).
      R. Sterner, 2009 Jan 07 --- Forced BEFORE key to be after AFTER.
      R. Sterner, 2009 Jan 07 --- Returned indices of matched keys.
      R. Sterner, 2010 Aug 18 --- Converted arrays from () to [].
      R. Sterner, 2011 May 27 --- Allowed INVERSE=txt2. Simplified code.
      R. Sterner, 2011 May 29 --- Initialized txtout to ''.
      R. Sterner, 2011 May 29 --- Now returns inverse if wanted even if err.
  Copyright (C) 2006, Johns Hopkins University/Applied Physics Laboratory
  This software may be used, copied, or redistributed as long as it is not
  sold and this copyright notice is reproduced on each copy made. This
  routine is provided as is without any express or implied warranties
  whatsoever. Other limitations apply as described in the file disclaimer.txt.



© 2019 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us