]> Creatis software - gdcm.git/blobdiff - src/gdcmUtil.cxx
Correction calcul 'gdcmZSize' dans AddAndDefaultElements.
[gdcm.git] / src / gdcmUtil.cxx
index 78bcff738034e44448562b9ef22a2a1a154849bb..127737e1d95a7773f62577eccbae3f5f3ebea1c7 100644 (file)
@@ -1,3 +1,5 @@
+// gdcmUtil.cxx
+
 #include <ctype.h>   // For isspace
 #include "gdcmUtil.h"
 
@@ -43,7 +45,7 @@ void gdcmDebug::Exit(int a) {
 
 gdcmDebug dbg;
 
-// Because is not yet available in g++2.06
+// Because is not yet available in g++2.96
 istream& eatwhite(istream& is) {
        char c;
        while (is.get(c)) {
@@ -55,3 +57,14 @@ istream& eatwhite(istream& is) {
        return is;
 }
 
+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);
+   }
+}