Trim an allocatable string or return an empty string if unallocated.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=:), | intent(in), | allocatable | :: | s |
pure function trim_or_empty(s) result(r) character(len=:), allocatable, intent(in) :: s character(len=:), allocatable :: r if (allocated(s)) then r = trim(s) else r = "" end if end function trim_or_empty