subroutinename_and_entityprivate
subroutine name_and_entity(text, name, entity)
Split name(entity).
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| text | character(len=*) | in | the text | |
| name | character(len=:) | out | allocatable | the name |
| entity | character(len=:) | out | allocatable | the entity type, or |
Source
Show the code
subroutine name_and_entity(text, name, entity)
character(len=*), intent(in) :: text !! the text
character(len=:), allocatable, intent(out) :: name !! the name
character(len=:), allocatable, intent(out) :: entity !! the entity type, or `''`
integer :: open
open = index(text, '(')
if (open > 0) then
name = text(:open - 1)
entity = text(open + 1:len(text) - 1)
else
name = text
entity = ''
end if
end subroutine name_and_entity