Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | c1 | |||
character(len=*), | intent(in) | :: | c2 |
pure function same_part_of_prefix (c1, c2) result(res) use :: forgex_utf8_m implicit none character(*), intent(in) :: c1, c2 character(:), allocatable :: res, part1, part2 logical :: flag_return integer :: i res = '' i = 1 flag_return = .false. do while(.not. flag_return) part1 = c1(i:idxutf8(c1, i)) part2 = c2(i:idxutf8(c2, i)) flag_return = next_idxutf8(c1, i) == INVALID_CHAR_INDEX .or. next_idxutf8(c2,i) == INVALID_CHAR_INDEX if (flag_return) return if (part1 == part2) then res = res//part1 else exit end if i = next_idxutf8(c1, i) end do end function same_part_of_prefix