summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/strutl.cc
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:52:40 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:52:40 +0000
commit1bc849af8f694ab80887bd0e9b94280f78771dbc (patch)
tree9ef7ce0628b4e3fb0bdd14b352507d8f3a09da2d /apt-pkg/contrib/strutl.cc
parent17caf1b19355813fa7a58828d4979ecf21b1e1f9 (diff)
Clean support
Author: jgg Date: 1999-02-01 08:11:57 GMT Clean support
Diffstat (limited to 'apt-pkg/contrib/strutl.cc')
-rw-r--r--apt-pkg/contrib/strutl.cc28
1 files changed, 26 insertions, 2 deletions
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
index e0188e3b8..b5086be04 100644
--- a/apt-pkg/contrib/strutl.cc
+++ b/apt-pkg/contrib/strutl.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: strutl.cc,v 1.18 1999/01/27 02:48:52 jgg Exp $
+// $Id: strutl.cc,v 1.19 1999/02/01 08:11:57 jgg Exp $
/* ######################################################################
String Util - Some usefull string functions.
@@ -116,7 +116,7 @@ bool ParseQuoteWord(const char *&String,string &Res)
{
Tmp[0] = Start[1];
Tmp[1] = Start[2];
- Tmp[3] = 0;
+ Tmp[2] = 0;
*I = (char)strtol(Tmp,0,16);
Start += 3;
continue;
@@ -177,6 +177,30 @@ bool ParseCWord(const char *String,string &Res)
return true;
}
/*}}}*/
+// DeQuoteString - Convert a string from quoted from /*{{{*/
+// ---------------------------------------------------------------------
+/* This undoes QuoteString */
+string DeQuoteString(string Str)
+{
+ string Res;
+ for (string::iterator I = Str.begin(); I != Str.end(); I++)
+ {
+ if (*I == '%' && I + 2 < Str.end())
+ {
+ char Tmp[3];
+ Tmp[0] = I[1];
+ Tmp[1] = I[2];
+ Tmp[2] = 0;
+ Res += (char)strtol(Tmp,0,16);
+ I += 2;
+ continue;
+ }
+ else
+ Res += *I;
+ }
+ return Res;
+}
+ /*}}}*/
// QuoteString - Convert a string into quoted from /*{{{*/
// ---------------------------------------------------------------------
/* */