We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3bcabad commit cdd2d4cCopy full SHA for cdd2d4c
src/util/StringView.hxx
@@ -1,5 +1,5 @@
1
/*
2
- * Copyright (C) 2013-2015 Max Kellermann <max.kellermann@gmail.com>
+ * Copyright (C) 2013-2017 Max Kellermann <max.kellermann@gmail.com>
3
*
4
* Redistribution and use in source and binary forms, with or without
5
* modification, are permitted provided that the following conditions
@@ -92,6 +92,13 @@ struct StringView : ConstBuffer<char> {
92
memcmp(data, needle.data, needle.size) == 0;
93
}
94
95
+ gcc_pure
96
+ bool EndsWith(StringView needle) const noexcept {
97
+ return size >= needle.size &&
98
+ memcmp(data + size - needle.size,
99
+ needle.data, needle.size) == 0;
100
+ }
101
+
102
gcc_pure
103
bool Equals(StringView other) const noexcept {
104
return size == other.size &&
0 commit comments