Character at i, or NUL outside the string.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | src |
source text |
||
| integer, | intent(in) | :: | i |
byte index, possibly outside |
pure character function peek(src, i) !! Character at `i`, or NUL outside the string. character(len=*), intent(in) :: src !! source text integer, intent(in) :: i !! byte index, possibly outside `src` if (i < 1 .or. i > len(src)) then peek = achar(0) else peek = src(i:i) end if end function peek