Inverted index: Difference between revisions

→‎{{header|D}}: regex splitter
(→‎{{header|D}}: added D)
(→‎{{header|D}}: regex splitter)
Line 966:
 
=={{header|D}}==
<lang d>import std.stdio, std.algorithm, std.file, std.string, std.regex;
 
void parseFile(in string fn, ref string[][string] idx) {
Line 972:
throw new Exception("File not found");
 
foreach (word; readText(fn).splitter(regex(r"\W"))) {
if (word in idx) {
if (canFind(idx[word], fn))
Anonymous user