Manual Reference Pages  - indent (3m_strings)

NAME

indent(3f) - [M_strings:WHITESPACE] count number of leading spaces in a string (LICENSE:PD)

CONTENTS

Synopsis
Description
Examples
Author
License

SYNOPSIS

function indent(line)

    integer                        :: indent
    character(len=*),intent(in)    :: line

DESCRIPTION

Count number of leading spaces in a CHARACTER variable.

EXAMPLES

Sample Program:

   program demo_indent
   !  test filter to count leading spaces in a character variable
   !  might want to call notabs(3f) to expand tab characters
   use M_strings, only : indent
   implicit none
   character(len=1024) :: in
   integer             :: iostat
      READFILE: do
         read(*,’(A)’,iostat=iostat)in
         if(iostat /= 0) exit READFILE
         write(*,’(i3,"",a)’)indent(in),trim(in)
      enddo READFILE
   end program demo_indent

Results:

     > 3   a b c
     > 0a b c
     > 6      a b c

AUTHOR

John S. Urban

LICENSE

Public Domain


Nemo Release 3.1 indent (3m_strings) July 20, 2024
Generated by manServer 1.08 from 87b23687-cdff-4d52-8108-14460344cd96 using man macros.