Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,44 @@
|
|||
!****************************************************
|
||||
module string_routines
|
||||
!****************************************************
|
||||
implicit none
|
||||
private
|
||||
public :: strip_comments
|
||||
contains
|
||||
!****************************************************
|
||||
|
||||
function strip_comments(str,c) result(str2)
|
||||
implicit none
|
||||
character(len=*),intent(in) :: str
|
||||
character(len=1),intent(in) :: c !comment character
|
||||
character(len=len(str)) :: str2
|
||||
|
||||
integer :: i
|
||||
|
||||
i = index(str,c)
|
||||
if (i>0) then
|
||||
str2 = str(1:i-1)
|
||||
else
|
||||
str2 = str
|
||||
end if
|
||||
|
||||
end function strip_comments
|
||||
|
||||
!****************************************************
|
||||
end module string_routines
|
||||
!****************************************************
|
||||
|
||||
!****************************************************
|
||||
program main
|
||||
!****************************************************
|
||||
! Example use of strip_comments function
|
||||
!****************************************************
|
||||
use string_routines, only: strip_comments
|
||||
implicit none
|
||||
|
||||
write(*,*) strip_comments('apples, pears # and bananas', '#')
|
||||
write(*,*) strip_comments('apples, pears ; and bananas', ';')
|
||||
|
||||
!****************************************************
|
||||
end program main
|
||||
!****************************************************
|
||||
Loading…
Add table
Add a link
Reference in a new issue