Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | string | |||
integer(kind=int32), | intent(in) | :: | from | |||
integer(kind=int32), | intent(in) | :: | to |
function text_highlight_green(string, from, to) result(res) implicit none character(*), intent(in) :: string integer(int32), intent(in) :: from, to character(:), allocatable :: res character(5) :: green = char(27)//"[32m" character(5) :: hend = char(27)//"[39m" character(4) :: bold = char(27)//"[1m" character(4) :: bend = char(27)//"[0m" res = '' if (from > 0 .and. to > 0 .and. from <= to .and. len(string) > 0) then res = string(1:from-1)//green//bold//string(from:to)//bend//hend//string(to+1:len(string)) else res = string end if end function text_highlight_green