Manual Reference Pages  - crop (3m_strings)

NAME

crop(3f) - [M_strings:WHITESPACE] trim leading and trailing blanks and control characters from a string (LICENSE:PD)

CONTENTS

Synopsis
Description
Options
Returns
Examples
See Also
Author
License

SYNOPSIS

function crop(strin) result (strout)

    character(len=*),intent(in)  :: strin
    character(len=:),allocatable :: strout

DESCRIPTION

Tabs are expanded assuming a stop every eight characters.
  All other control characters throughout the string are replaced with spaces and leading and trailing spaces are trimmed from the resulting string.
This means trailing characters like linefeed and carriage returns are removed. If this is not desired, see clip(3f).

OPTIONS

strin input string to trim leading and trailing space and control characters from

RETURNS

strout cropped version of input string

EXAMPLES

Sample program:

   program demo_crop
   use M_strings, only: crop
   implicit none
   character(len=20) ::  untrimmed = ’   ABCDEFG abcdefg  ’
      write(*,*) ’untrimmed string=[’,untrimmed,’]’
      write(*,*) ’cropped string=[’,crop(untrimmed),’]’
   end program demo_crop

Expected output

     untrimmed string=[   ABCDEFG abcdefg                      ]
     cropped string=[ABCDEFG abcdefg]

SEE ALSO

clip(3f)

AUTHOR

John S. Urban

LICENSE

Public Domain


Nemo Release 3.1 crop (3m_strings) July 20, 2024
Generated by manServer 1.08 from dfae6f5f-8128-4856-8213-6756772758ea using man macros.