functionends_withpure
pure logical function ends_with(s, suffix)
True if s finishes with suffix.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| s | character(len=*) | in | the string | |
| suffix | character(len=*) | in | the end wanted |
Result
| Name | Type | Attributes | Description |
|---|---|---|---|
| ends_with | logical |
Source
Show the code
pure logical function ends_with(s, suffix)
character(len=*), intent(in) :: s !! the string
character(len=*), intent(in) :: suffix !! the end wanted
ends_with = len(s) >= len(suffix)
if (ends_with) ends_with = s(len(s) - len(suffix) + 1:) == suffix
end function ends_with