functioncount_blankspureprivate
pure integer function count_blanks(s)
Number of blanks and tabs in s.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| s | character(len=*) | in | the string |
Result
| Name | Type | Attributes | Description |
|---|---|---|---|
| count_blanks | integer |
Source
Show the code
pure integer function count_blanks(s)
character(len=*), intent(in) :: s !! the string
integer :: k
count_blanks = 0
do k = 1, len(s)
if (s(k:k) == ' ' .or. s(k:k) == achar(9)) count_blanks = count_blanks + 1
end do
end function count_blanks