From 1fa680df8f1c8299da28e2280ec1b33c8850d2f7 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Wed, 27 Jun 2001 23:14:55 +0000 Subject: Added prefix matching to WordList::InList which takes any word in the list starting with '^' as a prefix. The rest of the word after the '^' is then checked against the argument and if it is a prefix then true is returned. --- src/PropSet.cxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src') diff --git a/src/PropSet.cxx b/src/PropSet.cxx index ac88e61c7..5287fb36b 100644 --- a/src/PropSet.cxx +++ b/src/PropSet.cxx @@ -532,6 +532,20 @@ bool WordList::InList(const char *s) { j++; } } + j = starts['^']; + if (j >= 0) { + while (words[j][0] == '^') { + const char *a = words[j] + 1; + const char *b = s; + while (*a && *a == *b) { + a++; + b++; + } + if (!*a) + return true; + j++; + } + } return false; } -- cgit v1.2.3