-
Notifications
You must be signed in to change notification settings - Fork 1
Count
Dionisis Pettas edited this page Dec 4, 2017
·
1 revision
- Count
Program Main
Use fString
Implicit None
Type(Str) :: MyStr
Integer :: Num
MyStr = 'MyFile1.dat,MyFile2.dat,MyFile3.dat,MyFile4.dat'
!<><><><><><><><><><><><><><><><><><><><><><><><><><><><>
! We Want to Count how many times the Substring='MyFile'
! appears is the string MyStr
!<><><><><><><><><><><><><><><><><><><><><><><><><><><><>
Num = MyStr%Count(Sub='MyFile')
Print*, Num
!OutPut: 4
!<><><><><><><><><><><><><><><><><><><><><><><><><><><><>
! If we want to Count how many times the Substring appears
! in the half of the string we use the Optional arguments
! Start and End
!<><><><><><><><><><><><><><><><><><><><><><><><><><><><>
Num = MyStr%Count(Sub='MyFile',Start=1,End= len(MyStr)/2)
Print*, Num
!OutPut: 2
End Program Main