-
Notifications
You must be signed in to change notification settings - Fork 1
Replace
Dionisis Pettas edited this page Dec 4, 2017
·
1 revision
Program Main
Use fString
Implicit None
Type(Str) :: MyStr
MyStr = "MyFile1.DAT,MyFile2.DAT,MyFile3.DAT"
!<><><><><><><><><><><><><><><><><><><><><><><><><><><><>
! Let's say that we want to Replace the '.DAT' with '.dat'
!<><><><><><><><><><><><><><><><><><><><><><><><><><><><>
MyStr = MyStr%Replace(Old='.DAT',New='.dat')
Print*, MyStr
! OutPut: MyFile1.dat,MyFile2.dat,MyFile3.dat
!<><><><><><><><><><><><><><><><><><><><><><><><><><><><>
! More if we want to replace ',' with the one space string
! But only the First One. So we use Max Argument (Optional)
!<><><><><><><><><><><><><><><><><><><><><><><><><><><><>
MyStr = MyStr%Replace(Old=',',New=' ',Max = 1)
Print*, MyStr
!OutPut: MyFile1.dat MyFile2.dat,MyFile3.dat
End Program Main