2012-02-01 01:12:54 -08:00
|
|
|
|
|
|
|
// StringUtils.h
|
|
|
|
|
|
|
|
// Interfaces to various string helper functions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef STRINGUTILS_H_INCLUDED
|
|
|
|
#define STRINGUTILS_H_INCLUDED
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef std::string AString;
|
|
|
|
typedef std::vector<AString> AStringVector;
|
2012-03-25 07:24:51 -07:00
|
|
|
typedef std::list<AString> AStringList;
|
2012-02-01 01:12:54 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Add the formated string to the existing data in the string
|
|
|
|
extern AString & AppendVPrintf(AString & str, const char * format, va_list args);
|
|
|
|
|
|
|
|
/// Output the formatted text into the string
|
|
|
|
extern AString & Printf (AString & str, const char * format, ...);
|
|
|
|
|
|
|
|
/// Add the formatted string to the existing data in the string
|
|
|
|
extern AString & AppendPrintf (AString & str, const char * format, ...);
|
|
|
|
|
|
|
|
/// Split the string at delimiters, return as a stringvector
|
|
|
|
extern AStringVector StringSplit(const AString & str, const AString & delim);
|
|
|
|
|
2012-06-04 05:08:20 -07:00
|
|
|
/// Trime whitespace at both ends of the string
|
|
|
|
extern AString TrimString(const AString & str);
|
|
|
|
|
2012-02-01 01:12:54 -08:00
|
|
|
/// In-place string conversion to uppercase; returns the same string
|
|
|
|
extern AString & StrToUpper(AString & s);
|
|
|
|
|
|
|
|
/// Case-insensitive string comparison; returns 0 if the strings are the same
|
|
|
|
extern int NoCaseCompare(const AString & s1, const AString & s2);
|
|
|
|
|
2012-02-01 14:38:03 -08:00
|
|
|
/// Replaces *each* occurence of iNeedle in iHayStack with iReplaceWith
|
|
|
|
extern void ReplaceString(AString & iHayStack, const AString & iNeedle, const AString & iReplaceWith);
|
|
|
|
|
2012-03-25 07:24:51 -07:00
|
|
|
/// Returns the list of all items in the specified directory (files, folders, nix pipes, whatever's there)
|
|
|
|
extern AStringList GetDirectoryContents(const char * a_Directory);
|
|
|
|
|
|
|
|
|
2012-02-01 01:12:54 -08:00
|
|
|
|
|
|
|
// If you have any other string helper functions, declare them here
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif // STRINGUTILS_H_INCLUDED
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|