notabs(3f) - [M_strings:NONALPHA] expand tab characters (LICENSE:PD)
Synopsis
Description
Options
Results
Examples
See Also
Author
License
subroutine notabs(INSTR,OUTSTR,ILEN)character(len=*),intent=(in) :: INSTR character(len=*),intent=(out) :: OUTSTR integer,intent=(out) :: ILEN
NOTABS() converts tabs in INSTR to spaces in OUTSTR while maintaining columns. It assumes a tab is set every 8 characters. Trailing spaces are removed.In addition, trailing carriage returns and line feeds are removed (they are usually a problem created by going to and from MSWindows).
What are some reasons for removing tab characters from an input line? Some Fortran compilers have problems with tabs, as tabs are not part of the Fortran character set. Some editors and printers will have problems with tabs. It is often useful to expand tabs in input files to simplify further processing such as tokenizing an input line.
instr Input line to remove tabs from
outstr Output string with tabs expanded. ilen Significant length of returned string
Sample program:
program demo_notabs! test filter to remove tabs and trailing white space from input ! on files up to 1024 characters wide use M_strings, only : notabs character(len=1024) :: in,out integer :: ios,iout READFILE: block do read(*,(A),iostat=ios)in if(ios /= 0) exit READFILE call notabs(in,out,iout) write(*,(a))out(:iout) enddo endblock READFILE
end program demo_notabs
GNU/Unix commands expand(1) and unexpand(1)
John S. Urban
Public Domain
notabs (3) | July 05, 2020 |