Get the base name without “output_” prefix and “.json” suffix Example: “output_w1.json” -> “w1”
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private | :: | end_pos | ||||
| integer, | private | :: | start_pos |
function get_basename() result(basename) !! Get the base name without "output_" prefix and ".json" suffix !! Example: "output_w1.json" -> "w1" character(len=256) :: basename integer :: start_pos, end_pos ! Remove "output_" prefix (7 characters) start_pos = 8 ! Find ".json" suffix end_pos = index(output_json_filename, '.json', back=.true.) - 1 if (end_pos > start_pos) then basename = output_json_filename(start_pos:end_pos) else basename = "unknown" end if end function get_basename