functionstarts_withpure
pure logical function starts_with(s, prefix)
True if s begins with prefix.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| s | character(len=*) | in | the string | |
| prefix | character(len=*) | in | the start wanted |
Result
| Name | Type | Attributes | Description |
|---|---|---|---|
| starts_with | logical |
Source
Show the code
pure logical function starts_with(s, prefix)
character(len=*), intent(in) :: s !! the string
character(len=*), intent(in) :: prefix !! the start wanted
starts_with = len(s) >= len(prefix)
if (starts_with) starts_with = s(1:len(prefix)) == prefix
end function starts_with