Aardio中,删除数组中的成员后,
转换成json字符串输出,
可以看到被删除的成员位置是null,
要想去掉null,
可以先使用table.concat()来清理一下,
再转换成json字符串输出就没有null成员了.
Aardio示例源码如下:
import win.ui;
/*DSG{{*/
var winform = win.form(text="aardio form";right=759;bottom=469)
winform.add(
button={cls="button";text="Button";left=370;top=404;right=463;bottom=449;z=2};
editLog={cls="edit";left=30;top=28;right=710;bottom=360;edge=1;multiline=1;z=1}
)
/*}}*/
winform.button.oncommand = function(id,event){
import console;
import web.json;
var newWordBookTab = web.json.parse(`["a","b","c"]`);
winform.editLog.print("1 newWordBookTab:",newWordBookTab);
table.removeByValue(newWordBookTab,"b");
winform.editLog.print("2 newWordBookTab:",newWordBookTab);
newWordBookTab = table.concat(newWordBookTab);//用这个能清空数组里的null成员
winform.editLog.print("3 newWordBookTab:",newWordBookTab);
newWordBookJsonStr = web.json.stringify(newWordBookTab,true,false);
winform.editLog.print("4 newWordBookJsonStr:",newWordBookJsonStr);
}
winform.show();
win.loopMessage();