Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
6876d160
Commit
6876d160
authored
Mar 13, 2020
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
util/StringCompare: add more StringView overloads
parent
a63d0ee8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
StringCompare.hxx
src/util/StringCompare.hxx
+18
-0
No files found.
src/util/StringCompare.hxx
View file @
6876d160
...
@@ -81,6 +81,14 @@ StringStartsWithIgnoreCase(const char *haystack, StringView needle) noexcept
...
@@ -81,6 +81,14 @@ StringStartsWithIgnoreCase(const char *haystack, StringView needle) noexcept
return
StringIsEqualIgnoreCase
(
haystack
,
needle
.
data
,
needle
.
size
);
return
StringIsEqualIgnoreCase
(
haystack
,
needle
.
data
,
needle
.
size
);
}
}
gcc_pure
static
inline
bool
StringStartsWithIgnoreCase
(
StringView
haystack
,
StringView
needle
)
noexcept
{
return
haystack
.
size
>=
needle
.
size
&&
StringIsEqualIgnoreCase
(
haystack
.
data
,
needle
.
data
,
needle
.
size
);
}
gcc_pure
gcc_nonnull_all
gcc_pure
gcc_nonnull_all
static
inline
const
char
*
static
inline
const
char
*
StringAfterPrefixIgnoreCase
(
const
char
*
haystack
,
StringView
needle
)
noexcept
StringAfterPrefixIgnoreCase
(
const
char
*
haystack
,
StringView
needle
)
noexcept
...
@@ -90,6 +98,16 @@ StringAfterPrefixIgnoreCase(const char *haystack, StringView needle) noexcept
...
@@ -90,6 +98,16 @@ StringAfterPrefixIgnoreCase(const char *haystack, StringView needle) noexcept
:
nullptr
;
:
nullptr
;
}
}
gcc_pure
static
inline
StringView
StringAfterPrefixIgnoreCase
(
StringView
haystack
,
StringView
needle
)
noexcept
{
return
StringStartsWithIgnoreCase
(
haystack
,
needle
)
?
haystack
.
substr
(
needle
.
size
)
:
nullptr
;
}
/**
/**
* Check if the given string ends with the specified suffix. If yes,
* Check if the given string ends with the specified suffix. If yes,
* returns the position of the suffix, and nullptr otherwise.
* returns the position of the suffix, and nullptr otherwise.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment