diff options
Diffstat (limited to '')
-rw-r--r-- | src/util/StringUtil.cxx | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/util/StringUtil.cxx b/src/util/StringUtil.cxx index 7e295bf90..57fc5188b 100644 --- a/src/util/StringUtil.cxx +++ b/src/util/StringUtil.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2013 The Music Player Daemon Project + * Copyright (C) 2003-2014 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -22,6 +22,7 @@ #include "ASCII.hxx" #include <assert.h> +#include <string.h> const char * strchug_fast(const char *p) @@ -33,6 +34,13 @@ strchug_fast(const char *p) } bool +StringStartsWith(const char *haystack, const char *needle) +{ + const size_t length = strlen(needle); + return memcmp(haystack, needle, length) == 0; +} + +bool string_array_contains(const char *const* haystack, const char *needle) { assert(haystack != nullptr); |