notabs(3f) - [M_strings:NONALPHA] expand tab characters (LICENSE:PD)
Synopsis
Description
Options
Returns
Examples
See Also
Author
License
subroutine notabs(INSTR,OUTSTR,lgth)
character(len=*),intent=(in) :: INSTR character(len=*),intent=(out) :: OUTSTR integer,intent=(out) :: lgth
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. Assumed to be of sufficient length lgth 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 :: iostat,iout do read(*,(A),iostat=iostat)in if(iostat /= 0) exit call notabs(in,out,iout) write(*,(a))out(:iout) enddo end program demo_notabs
GNU/Unix commands expand(1) and unexpand(1)
John S. Urban
Public Domain
Nemo Release 3.1 | notabs (3m_strings) | July 20, 2024 |