functionsplit_on
The parts of text between the characters sep, including empty ones.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| text | character(len=*) | in | the text | |
| sep | character(len=1) | in | the separator |
Result
| Name | Type | Attributes | Description |
|---|---|---|---|
| parts | type(string_t) | privateallocatabledimension(:) |
Calls
Called by
- apply_toml_string
- code_block
- definition_block
- lexical_clean
- link_calls
- list_items
- loose_detab
- quote_block
- render_table
Source
Show the code
function split_on(text, sep) result(parts)
character(len=*), intent(in) :: text !! the text
character, intent(in) :: sep !! the separator
type(string_t), allocatable :: parts(:)
integer :: i, j
allocate (parts(0))
i = 1
do
j = index(text(i:), sep)
if (j == 0) then
call push(parts, text(i:))
exit
end if
call push(parts, text(i:i + j - 2))
i = i + j
end do
end function split_on