]>
git.saurik.com Git - apt.git/blob - apt-pkg/contrib/strutl.h
1 // -*- mode: cpp; mode: fold -*-
3 // $Id: strutl.h,v 1.5 1998/10/20 02:39:31 jgg Exp $
4 /* ######################################################################
6 String Util - These are some usefull string functions
8 _strstrip is a function to remove whitespace from the front and end
11 This source is placed in the Public Domain, do with it what you will
12 It was originally written by Jason Gunthorpe <jgg@gpu.srv.ualberta.ca>
14 ##################################################################### */
16 // This is a private header
24 char *_strstrip(char *String
);
25 char *_strtabexpand(char *String
,size_t Len
);
26 bool ParseQuoteWord(const char *&String
,string
&Res
);
27 bool ParseCWord(const char *String
,string
&Res
);
28 string
QuoteString(string Str
,const char *Bad
);
29 string
SizeToStr(double Bytes
);
30 string
TimeToStr(unsigned long Sec
);
31 string
SubstVar(string Str
,string Subst
,string Contents
);
32 string
Base64Encode(string Str
);
33 string
URItoFileName(string URI
);
34 string
URIAccess(string URI
);
36 int stringcmp(const char *A
,const char *AEnd
,const char *B
,const char *BEnd
);
37 inline int stringcmp(const char *A
,const char *AEnd
,const char *B
) {return stringcmp(A
,AEnd
,B
,B
+strlen(B
));};
38 int stringcasecmp(const char *A
,const char *AEnd
,const char *B
,const char *BEnd
);
39 inline int stringcasecmp(const char *A
,const char *AEnd
,const char *B
) {return stringcasecmp(A
,AEnd
,B
,B
+strlen(B
));};
40 string
LookupTag(string Message
,const char *Tag
,const char *Default
= 0);
41 int StringToBool(string Text
,int Default
= -1);