--- deliantra/server/include/shstr.h 2007/04/23 15:27:46 1.13 +++ deliantra/server/include/shstr.h 2007/05/14 21:52:32 1.15 @@ -33,6 +33,14 @@ return length (s); } + // returns wether this shared string begins with the given prefix, + // used mainly for searched when users give only the start of a name. + bool begins_with (const char *prefix) const + { + int plen = strlen (prefix); + return !strncasecmp (s, prefix, plen) && length () >= plen; + } + static const char *find (const char *s); static const char *intern (const char *s); @@ -115,7 +123,7 @@ return a != b; } -std::ostream &operator <<(std::ostream &o, const shstr &sh) +static std::ostream &operator <<(std::ostream &o, const shstr &sh) { o.write (sh.s, sh.length ()); return o;