C Library Functions  - matching_delimiter (3)

NAME

matching_delimiter(3f) - [M_strings:QUOTES] find position of matching delimiter (LICENSE:PD)

CONTENTS

Synopsis
Description
Options
Example
Author
License

SYNOPSIS

impure elemental subroutine matching_delimiter(str,ipos,imatch)

   character(len=*),intent(in)  :: str
   integer,intent(in)           :: ipos
   integer,intent(out)          :: imatch

DESCRIPTION

Sets imatch to the position in string of the delimiter matching the delimiter in position ipos. Allowable delimiters are (), [], {}, <>.

OPTIONS

str input string to locate delimiter position in
ipos position of delimiter to find match for
imatch location of matching delimiter. If no match is found, zero (0) is returned.

EXAMPLE

Sample program:

   program demo_matching_delimiter
      use M_strings, only : matching_delimiter
      implicit none
      character(len=128)  :: str
      integer             :: imatch

str=’ a [[[[b] and ] then ] finally ]’ write(*,*)’string=’,str call matching_delimiter(str,1,imatch) write(*,*)’location=’,imatch call matching_delimiter(str,4,imatch) write(*,*)’location=’,imatch call matching_delimiter(str,5,imatch) write(*,*)’location=’,imatch call matching_delimiter(str,6,imatch) write(*,*)’location=’,imatch call matching_delimiter(str,7,imatch) write(*,*)’location=’,imatch call matching_delimiter(str,32,imatch) write(*,*)’location=’,imatch

end program demo_matching_delimiter

AUTHOR

John S. Urban

LICENSE

Public Domain


Nemo Release 3.1 matching_delimiter (3) July 22, 2023
Generated by manServer 1.08 from 98014e8e-3955-4a43-a62f-c56655bfdd8a using man macros.