Remove inline comments from a srting s, comments should begin with the string or character contained in comment_char
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | s |
String in input |
||
character(len=*), | intent(in) | :: | comment_char |
Char that begin the comment |
String converted to lowercase
function str_uncomment(s, comment_char)
!! Remove inline comments from a srting s, comments should
!! begin with the string or character contained in comment_char
implicit none
character(len=*), intent(in) :: s
!! String in input
character(len=*), intent(in) :: comment_char
!! Char that begin the comment
character(len(s)) :: str_uncomment
!! String converted to lowercase
integer(ip) :: idx
str_uncomment = ' '
idx = index(s, comment_char)
if(idx > 0) then
str_uncomment(1:idx-1) = s(1:idx-1)
else
str_uncomment = s
end if
end function str_uncomment