nospace(3f) - [M_strings:WHITESPACE] remove all whitespace from input string (LICENSE:PD)
Synopsis
Description
Examples
Author
License
function nospace(str) - remove all whitespace from input string
character(len=*),intent(in) :: str character(len=:),allocatable :: nospace
nospace(3f) removes space, tab, carriage return, new line, vertical tab, formfeed and null characters (called "whitespace"). The output is returned trimmed.
Sample program:
program demo_nospace use M_strings, only: nospace implicit none character(len=:),allocatable :: s s= This is a test write(*,*) original input string is ....,s write(*,*) processed output string is ...,nospace(s) if(nospace(s) == Thisisatest)then write(*,*)nospace test passed else write(*,*)nospace test error endif end program demo_nospaceExpected output
original input string is .... This is a test processed output string is ...Thisisatest nospace test passed
John S. Urban
Public Domain
Nemo Release 3.1 | nospace (3m_strings) | January 10, 2025 |