From 4fb400a66f2436cba6c89cecdc9560c9b1c54337 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 15 Mar 2013 14:57:27 +0100 Subject: split out a method to strip whitespaces only on the right side --- apt-pkg/contrib/strutl.cc | 8 +++++++- apt-pkg/contrib/strutl.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'apt-pkg/contrib') diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index ca096d736..9726138a0 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -117,7 +117,13 @@ char *_strstrip(char *String) if (*String == 0) return String; - + return _strrstrip(String); +} + /*}}}*/ +// strrstrip - Remove white space from the back of a string /*{{{*/ +// --------------------------------------------------------------------- +char *_strrstrip(char *String) +{ char *End = String + strlen(String) - 1; for (;End != String - 1 && (*End == ' ' || *End == '\t' || *End == '\n' || *End == '\r'); End--); diff --git a/apt-pkg/contrib/strutl.h b/apt-pkg/contrib/strutl.h index 337139d5d..e92f91dc0 100644 --- a/apt-pkg/contrib/strutl.h +++ b/apt-pkg/contrib/strutl.h @@ -35,6 +35,7 @@ using std::ostream; bool UTF8ToCodeset(const char *codeset, const std::string &orig, std::string *dest); char *_strstrip(char *String); +char *_strrstrip(char *String); // right strip only char *_strtabexpand(char *String,size_t Len); bool ParseQuoteWord(const char *&String,std::string &Res); bool ParseCWord(const char *&String,std::string &Res); -- cgit v1.2.3