crop(3f) - [M_strings:WHITESPACE] trim leading and trailing blanks and control characters from a string (LICENSE:PD)
Synopsis
Description
Options
Returns
Examples
See Also
Author
License
function crop(strin) result (strout)
character(len=*),intent(in) :: strin character(len=:),allocatable :: strout
This means trailing characters like linefeed and carriage returns are removed. If this is not desired, see clip(3f).
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.
strin input string to trim leading and trailing space and control characters from
strout cropped version of input string
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_cropExpected output
untrimmed string=[ ABCDEFG abcdefg ] cropped string=[ABCDEFG abcdefg]
clip(3f)
John S. Urban
Public Domain
Nemo Release 3.1 | crop (3m_strings) | July 20, 2024 |