Parse a comma-separated --features value into the features array.
Empty tokens are ignored; whitespace around tokens is stripped.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(string_t), | intent(inout), | allocatable | :: | features(:) | ||
| character(len=*), | intent(in) | :: | csv |
subroutine add_features_csv(features, csv) type(string_t), allocatable, intent(inout) :: features(:) character(len=*), intent(in) :: csv integer :: n, p, q character(len=:), allocatable :: s, tok s = trim(csv) if (len_trim(s) == 0) return p = 1 n = len_trim(s) do if (p > n) exit q = index(s(p:), ",") if (q == 0) then tok = adjustl(s(p:n)) call push_feature(features, trim(tok)) exit else tok = adjustl(s(p:p+q-2)) call push_feature(features, trim(tok)) p = p + q end if end do end subroutine add_features_csv