trim Interface

public interface trim

Removes every character in chars from both ends of string. For a String, chars is optional and defaults to whitespace. trim(string) with one character argument is still the intrinsic trim.


Module Procedures

private pure recursive function trim_chars(string, chars) result(res)

Not elemental, like the intrinsic trim, since the length of the result depends on the value of string.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: string
character(len=*), intent(in) :: chars

Return Value character(len=:), allocatable

private elemental recursive function trim_string(string, chars) result(res)

Arguments

Type IntentOptional Attributes Name
type(String), intent(in) :: string
character(len=*), intent(in), optional :: chars

Return Value type(String)