diff options
author | Michael Vogt <mvo@debian.org> | 2013-11-29 08:35:05 +0100 |
---|---|---|
committer | Michael Vogt <mvo@debian.org> | 2013-11-29 08:37:54 +0100 |
commit | cf993341c2067ee091cfd51e5da0e237babce171 (patch) | |
tree | 1ece0eaaaea76acf5fba1c74054873d80ef633b5 /apt-pkg/contrib/strutl.cc | |
parent | a8f671c17a7f34e80a49bf367bceaa009551b066 (diff) |
add "APT::String::Endswith" and automatic adding of ".list" in apt edit-source
Diffstat (limited to 'apt-pkg/contrib/strutl.cc')
-rw-r--r-- | apt-pkg/contrib/strutl.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index 9f794927d..962112854 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -49,6 +49,14 @@ std::string Strip(const std::string &s) size_t end = s.find_last_not_of(" \t\n"); return s.substr(start, end-start+1); } + +bool Endswith(const std::string &s, const std::string &end) +{ + if (end.size() > s.size()) + return false; + return (s.substr(s.size() - end.size(), s.size()) == end); +} + } } /*}}}*/ |