Remove trailing spaces.
type(string) :: astring
astring = 'Hello World! '
print "(L1)", astring%trim()==trim('Hello World! ')
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string), | intent(in) | :: | self |
The string. |
Trimmed string.
elemental function strim(self) result(trimmed) !< Remove trailing spaces. !< !<```fortran !< type(string) :: astring !< astring = 'Hello World! ' !< print "(L1)", astring%trim()==trim('Hello World! ') !<``` !=> T <<< class(string), intent(in) :: self !< The string. type(string) :: trimmed !< Trimmed string. trimmed = self if (allocated(trimmed%raw)) trimmed%raw = trim(trimmed%raw) endfunction strim