How would I iterate through a list in KDB Q and replace elements which do not match a certain sub-string criteria?
Logic Example Pseudocode:
list.stream()
.forEach(x -> {
if (x matches substring) :
newList.add(x)
else :
newList.add("")
})
Current List:
S: ("Lint"; "Stack"; "Linode"; "Overflow";"Linux")
The sub-string to match is "Li" here. As such, strings "Stack" and "Overflow" are replaced by empty Strings as they do not contain the sub-string.
Resultant List:
S: ("Lint"; ""; "Linode"; "";"Linux")