-void Tokenize (const string& str,
- vector<string>& tokens,
- const string& delimiters = " ") {
- string::size_type lastPos = str.find_first_not_of(delimiters,0);
- string::size_type pos = str.find_first_of(delimiters,lastPos);
- while (string::npos != pos || string::npos != lastPos) {
- tokens.push_back(str.substr(lastPos, pos - lastPos));
- lastPos = str.find_first_not_of(delimiters, pos);
- pos = str.find_first_of(delimiters, lastPos);
+/**
+ * \ingroup Util
+ * \brief Get the (last) name of a full path file name
+ * @param fullName file/directory name to extract end name from
+ */
+std::string Util::GetName(std::string const & fullName)
+{
+ std::string filename = fullName;
+
+ std::string::size_type slash_pos = filename.rfind("/");
+ std::string::size_type backslash_pos = filename.rfind("\\");
+ slash_pos = slash_pos > backslash_pos ? slash_pos : backslash_pos;
+ if(slash_pos != std::string::npos)
+ {
+ return filename.substr(slash_pos + 1);
+ }
+ else
+ {
+ return filename;
+ }
+}
+
+/**
+ * \ingroup Util
+ * \brief Create a /DICOM/ string:
+ * It should a of even lenght (no odd length ever)
+ * It can contains as many \0 as you want.
+ * This function is similar to DicomString(const char*),
+ * except it doesn't take a lenght.
+ * It only pad with a null character if length is odd
+ */
+std::string Util::DicomString(const char* s)
+{
+ size_t l = strlen(s);
+ if( l%2 )
+ {
+ l++;