caudio/Headers/cUtils.h

19 lines
533 B
C
Raw Normal View History

2009-06-21 05:24:30 +02:00
#ifndef CUTILS_H_INCLUDED
#define CUTILS_H_INCLUDED
#include <string>
//!Grabs the current extention of a given string.
static std::string getExt(const std::string& filename)
{
2009-06-21 05:24:30 +02:00
if(filename.find_last_of(".") == std::string::npos) return filename;
return filename.substr(filename.find_last_of(".") + 1, filename.length()-filename.find_last_of(".")-1);
}
static std::string safeCStr(const char* str)
{
if( str != NULL ) return std::string(str);
else return std::string("");
}
2009-06-21 05:24:30 +02:00
#endif //! CUTILS_H_INCLUDED