Return the raw characters data sliced.
type(string) :: astring
astring = 'the Quick Brown fox Jumps over the Lazy Dog.'
print "(A)", astring%slice(11,25)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string), | intent(in) | :: | self |
The string. |
||
integer, | intent(in) | :: | istart |
Slice start index. |
||
integer, | intent(in) | :: | iend |
Slice end index. |
Raw characters data.
pure function slice(self, istart, iend) result(raw)
!< Return the raw characters data sliced.
!<
!<```fortran
!< type(string) :: astring
!< astring = 'the Quick Brown fox Jumps over the Lazy Dog.'
!< print "(A)", astring%slice(11,25)
!<```
!=> Brown fox Jumps <<<
class(string), intent(in) :: self !< The string.
integer, intent(in) :: istart !< Slice start index.
integer, intent(in) :: iend !< Slice end index.
character(kind=CK, len=:), allocatable :: raw !< Raw characters data.
if (allocated(self%raw)) then
raw = self%raw(istart:iend)
else
raw = ''
endif
endfunction slice