Width of the longest line of text, in characters (as utf8_width counts them).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | text |
text whose lines end with LF |
pure integer function longest_line(text) result(width) !! Width of the longest line of `text`, in characters (as [[utf8_width]] counts them). character(len=*), intent(in) :: text !! text whose lines end with LF integer :: k, c, w width = 0 w = 0 do k = 1, len(text) c = iand(ichar(text(k:k)), 255) if (c == 10) then w = 0 else if (c < 128 .or. c >= 192) then w = w + 1 width = max(width, w) end if end do end function longest_line