从 kdb 中的字符串列表中删除空字符串
Remove empty string from a list of strings in kdb
我有一个字符串列表:
q)l:("abc";"";"def";"");
我们如何从列表 l 中删除空字符串?
Desired Output:
("abc";"def")
我失败的尝试:
q)l except ""
q)l except\: ""
q)l except 1#""
在空字符串上使用 enlist 将起作用:
q)l except enlist""
"abc"
"def"
在很多情况下,1#
和 enlist
可以互换使用,只要列表不为空即可。在空列表上应用 1#
将 return 提供的空列表类型的入伍空值:
q)1#`long$()
,0N
q)1#`symbol$()
,`
q)1#""
," "
我有一个字符串列表:
q)l:("abc";"";"def";"");
我们如何从列表 l 中删除空字符串?
Desired Output:
("abc";"def")
我失败的尝试:
q)l except ""
q)l except\: ""
q)l except 1#""
在空字符串上使用 enlist 将起作用:
q)l except enlist""
"abc"
"def"
在很多情况下,1#
和 enlist
可以互换使用,只要列表不为空即可。在空列表上应用 1#
将 return 提供的空列表类型的入伍空值:
q)1#`long$()
,0N
q)1#`symbol$()
,`
q)1#""
," "