functioncount_newlinespureprivate
pure integer function count_newlines(text)
Number of line feeds in text.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| text | character(len=*) | in | the text |
Result
| Name | Type | Attributes | Description |
|---|---|---|---|
| count_newlines | integer |
Source
Show the code
pure integer function count_newlines(text)
character(len=*), intent(in) :: text !! the text
integer :: k
count_newlines = 0
do k = 1, len(text)
if (text(k:k) == NL) count_newlines = count_newlines + 1
end do
end function count_newlines