File: example_slice.f90

package info (click to toggle)
fortran-stdlib 0.8.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 34,008 kB
  • sloc: f90: 24,178; ansic: 1,244; cpp: 623; python: 119; makefile: 13
file content (20 lines) | stat: -rw-r--r-- 445 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
program example_slice
  use stdlib_string_type
  use stdlib_strings, only: slice
  implicit none
  type(string_type) :: string
  character(len=10) :: chars

  string = "abcdefghij"
! string <-- "abcdefghij"

  chars = "abcdefghij"
! chars <-- "abcdefghij"

  print'(a)', slice("abcdefghij", 2, 6, 2)   ! "bdf"
  print'(a)', slice(chars, 2, 6, 2)           ! "bdf"

  string = slice(string, 2, 6, 2)
! string <-- "bdf"

end program example_slice