VB は分からないので今度はRubyで。
class String
def head; self[0].chr end
def tail; self[1...(self.length)] end
end
class Array
def head; self[0] end
def tail; self[1...(self.length)] end
end
str=%([["3014","Null","0-16-087"],["1999","10","0-06-074"]])
def addItem(item, ls)
last = ls.pop
ls.push(last.push(item))
ls
end
def myEval(inString, out, tstr, flag)
return out if inString.length==0
head = inString.head
tail = inString.tail
if head == '[' then myEval(tail, out.push([]), tstr, flag)
elsif head == ']' then myEval(tail, out, tstr, flag)
elsif head == ',' then myEval(tail, out, tstr, flag)
elsif head == '"' then if flag then myEval(tail, (addItem tstr,out), "", false)
else myEval(tail, out, tstr, true) end
else myEval(tail, out, (tstr + head) , true) end
end
p myEval(str, [] ,"" ,false).tail