public pure subroutine split(string, set, pos, back)
Parse a string into tokens, one at a time. This subroutine implements the split intrinsic procedure as defined in
the Fortran 2023 language standard (Section 16.9.196). We implement it ourselves because the compiler support may
take years to become widespread.
(KCW, 2025-10-29)
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Variables
Type
Visibility
Attributes
Name
Initial
integer,
private
::
offset
Source Code
pure subroutine split(string,set,pos,back)character(*),intent(in)::string,setinteger,intent(inout)::poslogical,optional,intent(in)::backinteger::offsetif(present(back))then if(back)thenoffset=clamp(pos,1,len(string)+1)pos=scan(string(1:offset-1),set,back=.true.)return end if end ifoffset=clamp(pos,0,len(string))pos=scan(string(offset+1:),set)if(pos==0)thenpos=len(string)+1return end ifpos=offset+posend subroutine split