Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string), | intent(in) | :: | self | The string. |
||
character(kind=CK,len=*), | intent(in) | :: | prefix | Searched prefix. |
||
integer, | intent(in), | optional | :: | start | Start position into the string. |
|
integer, | intent(in), | optional | :: | end | End position into the string. |
Result of the test.
Return true if a string starts with a specified prefix.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public | :: | start_ | Start position into the string, local variable. |
|||
integer, | public | :: | end_ | End position into the string, local variable. |
elemental function start_with(self, prefix, start, end)
!---------------------------------------------------------------------------------------------------------------------------------
!< Return true if a string starts with a specified prefix.
!---------------------------------------------------------------------------------------------------------------------------------
class(string), intent(in) :: self !< The string.
character(kind=CK, len=*), intent(in) :: prefix !< Searched prefix.
integer, intent(in), optional :: start !< Start position into the string.
integer, intent(in), optional :: end !< End position into the string.
logical :: start_with !< Result of the test.
integer :: start_ !< Start position into the string, local variable.
integer :: end_ !< End position into the string, local variable.
!---------------------------------------------------------------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------------------------------------
start_with = .false.
if (allocated(self%raw)) then
start_ = 1 ; if (present(start)) start_ = start
end_ = len(self%raw) ; if (present(end)) end_ = end
if (len(prefix)<=len(self%raw(start_:end_))) then
start_with = index(self%raw(start_:end_), prefix)==1
endif
endif
return
!---------------------------------------------------------------------------------------------------------------------------------
endfunction start_with