X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmUtil.cxx;h=127737e1d95a7773f62577eccbae3f5f3ebea1c7;hb=bb2cb788a245b6377a70de3e8a502dab036165ab;hp=78bcff738034e44448562b9ef22a2a1a154849bb;hpb=8e657a0766489604ade10a101d0d8995bcb79280;p=gdcm.git diff --git a/src/gdcmUtil.cxx b/src/gdcmUtil.cxx index 78bcff73..127737e1 100644 --- a/src/gdcmUtil.cxx +++ b/src/gdcmUtil.cxx @@ -1,3 +1,5 @@ +// gdcmUtil.cxx + #include // 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& 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); + } +}