From bb49f0e021fb1fbefad44d944233fb1cf72c495c Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Wed, 1 Feb 2012 09:12:54 +0000 Subject: Introducing StringUtils - the place to be if you are a generic string routine :) No more sprintf()! git-svn-id: http://mc-server.googlecode.com/svn/trunk@209 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/StringUtils.h | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 source/StringUtils.h (limited to 'source/StringUtils.h') diff --git a/source/StringUtils.h b/source/StringUtils.h new file mode 100644 index 000000000..97e42f5f5 --- /dev/null +++ b/source/StringUtils.h @@ -0,0 +1,51 @@ + +// StringUtils.h + +// Interfaces to various string helper functions + + + + +#ifndef STRINGUTILS_H_INCLUDED +#define STRINGUTILS_H_INCLUDED + + + + + +typedef std::string AString; +typedef std::vector AStringVector; + + + + + +/// 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); + +/// 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); + + +// If you have any other string helper functions, declare them here + + + + +#endif // STRINGUTILS_H_INCLUDED + + + + -- cgit v1.2.3