Number of characters of i as text, with any sign.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | i |
the number |
pure integer function int_width(i) !! Number of characters of `i` as text, with any sign. integer, intent(in) :: i !! the number integer :: n n = i int_width = merge(2, 1, i < 0) do n = n/10 if (n == 0) exit int_width = int_width + 1 end do end function int_width