functionreplace_commaspureprivate
pure character(len=len(attr)+comma_count(attr)) function replace_commas(attr) result(out)
attr with a blank after each comma.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| attr | character(len=*) | in | the text |
Result
| Name | Type | Attributes | Description |
|---|---|---|---|
| out | character(len=len(attr)+comma_count(attr)) | private |
Source
Show the code
pure function replace_commas(attr) result(out)
character(len=*), intent(in) :: attr !! the text
character(len=len(attr) + comma_count(attr)) :: out
integer :: k, n
n = 0
do k = 1, len(attr)
n = n + 1
out(n:n) = attr(k:k)
if (attr(k:k) == ',') then
n = n + 1
out(n:n) = ' '
end if
end do
end function replace_commas