strutl.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: strutl.h,v 1.4 1998/09/22 05:30:29 jgg Exp $
  4. /* ######################################################################
  5. String Util - These are some usefull string functions
  6. _strstrip is a function to remove whitespace from the front and end
  7. of a string.
  8. This source is placed in the Public Domain, do with it what you will
  9. It was originally written by Jason Gunthorpe <jgg@gpu.srv.ualberta.ca>
  10. ##################################################################### */
  11. /*}}}*/
  12. // This is a private header
  13. // Header section: /
  14. #ifndef STRUTL_H
  15. #define STRUTL_H
  16. #include <stdlib.h>
  17. #include <string>
  18. char *_strstrip(char *String);
  19. char *_strtabexpand(char *String,size_t Len);
  20. bool ParseQuoteWord(const char *&String,string &Res);
  21. bool ParseCWord(const char *String,string &Res);
  22. string QuoteString(string Str,const char *Bad);
  23. string SizeToStr(double Bytes);
  24. string TimeToStr(unsigned long Sec);
  25. string SubstVar(string Str,string Subst,string Contents);
  26. string Base64Encode(string Str);
  27. string URItoFileName(string URI);
  28. int stringcmp(const char *A,const char *AEnd,const char *B,const char *BEnd);
  29. inline int stringcmp(const char *A,const char *AEnd,const char *B) {return stringcmp(A,AEnd,B,B+strlen(B));};
  30. int stringcasecmp(const char *A,const char *AEnd,const char *B,const char *BEnd);
  31. inline int stringcasecmp(const char *A,const char *AEnd,const char *B) {return stringcasecmp(A,AEnd,B,B+strlen(B));};
  32. #endif