functionstrippure
pure character(len=stripped_length(s)) function strip(s) result(t)
s without leading and trailing whitespace.
This and the other functions here that are used while parsing give their results an explicit
length: gfortran keeps the length of a deferred-length result in static storage, so it is not
safe in parallel regions (see example/slen_race.f90).
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| s | character(len=*) | in | the string |
Result
| Name | Type | Attributes | Description |
|---|---|---|---|
| t | character(len=stripped_length(s)) | private |
Source
Show the code
pure function strip(s) result(t)
character(len=*), intent(in) :: s !! the string
character(len=stripped_length(s)) :: t
integer :: a
a = verify(s, WHITESPACE)
if (a > 0) t = s(a:)
end function strip