mirror of
https://github.com/NixOS/nix.git
synced 2025-11-14 22:42:41 +01:00
Grmbl
This commit is contained in:
parent
36f363b8f0
commit
1e4885e316
2 changed files with 10 additions and 0 deletions
|
|
@ -1171,6 +1171,12 @@ bool statusOk(int status)
|
|||
}
|
||||
|
||||
|
||||
bool hasPrefix(const string & s, const string & suffix)
|
||||
{
|
||||
return s.compare(0, suffix.size(), suffix) == 0;
|
||||
}
|
||||
|
||||
|
||||
bool hasSuffix(const string & s, const string & suffix)
|
||||
{
|
||||
return s.size() >= suffix.size() && string(s, s.size() - suffix.size()) == suffix;
|
||||
|
|
|
|||
|
|
@ -365,6 +365,10 @@ template<class N> bool string2Int(const string & s, N & n)
|
|||
}
|
||||
|
||||
|
||||
/* Return true iff `s' starts with `prefix'. */
|
||||
bool hasPrefix(const string & s, const string & prefix);
|
||||
|
||||
|
||||
/* Return true iff `s' ends in `suffix'. */
|
||||
bool hasSuffix(const string & s, const string & suffix);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue