slice Function

private pure function slice(self, istart, iend) result(raw)

Arguments

TypeIntentOptionalAttributesName
class(string), intent(in) :: self
integer, intent(in) :: istart
integer, intent(in) :: iend

Return Value character(kind=CK,len=:),allocatable


Contents

Source Code


Source Code

   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