diff --git a/library/Misc_Helpers.ttcn b/library/Misc_Helpers.ttcn index cbc1e70b3..fd2e7bb99 100644 --- a/library/Misc_Helpers.ttcn +++ b/library/Misc_Helpers.ttcn @@ -79,4 +79,24 @@ function f_strstr_count(in charstring str, in charstring sub_str) return integer return count; } +type record of charstring ro_charstring; +function f_str_split(charstring str, charstring delim := "\n") return ro_charstring +{ + var integer pos := 0; + var ro_charstring parts := {}; + var integer delim_pos; + var integer end := lengthof(str); + while (pos < end) { + delim_pos := f_strstr(str, delim, pos); + if (delim_pos < 0) { + delim_pos := end; + } + if (delim_pos > pos) { + parts := parts & { substr(str, pos, delim_pos - pos) }; + } + pos := delim_pos + 1; + } + return parts; +} + } diff --git a/library/Osmocom_VTY_Functions.ttcn b/library/Osmocom_VTY_Functions.ttcn index 6b0883f9b..dd3ba3b80 100644 --- a/library/Osmocom_VTY_Functions.ttcn +++ b/library/Osmocom_VTY_Functions.ttcn @@ -274,25 +274,6 @@ function f_verify_talloc_count(TELNETasp_PT pt, StrList object_strs, integer exp Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "talloc count mismatch"); } -public function f_str_split(charstring str, charstring delim := "\n") return ro_charstring -{ - var integer pos := 0; - var ro_charstring parts := {}; - var integer delim_pos; - var integer end := lengthof(str); - while (pos < end) { - delim_pos := f_strstr(str, delim, pos); - if (delim_pos < 0) { - delim_pos := end; - } - if (delim_pos > pos) { - parts := parts & { substr(str, pos, delim_pos - pos) }; - } - pos := delim_pos + 1; - } - return parts; -} - public function f_verify_talloc_bytes(TELNETasp_PT pt, ro_charstring object_strs, integer expect_bytes := 0, integer attempts := 5, float wait_time := 3.0) {