Page 1 of 1

Parse issue

Posted: Wed Sep 19, 2018 4:30 pm
by tuncerinan
Hi Dear,

How ı parse this value ether1:cc|ether2:xx|ether9:zz| .I wanna parse between | .


Result:
ether1:cc
ether2:xx
ether9:zz



Thanks.

Re: Parse issue

Posted: Fri Sep 21, 2018 9:51 am
by rendezz
Try this
:local test "ether1:cc|ether2:xx|ether9:zz|"
:local found 0

:while ([:len ($test)] > 0) do={
	:set found [:find $test "|" -1]
	:if ($found = "") do={
	     :put $test
	     :set test ""
	} else={
	     :put [:pick $test 0 $found]
	     :set test [:pick $test ($found+1) [:len ($test)]]
	}
}