+++ /dev/null
-#include <cpPlugins/OS/String.h>
-#include <cstring>
-
-// -------------------------------------------------------------------------
-#ifdef cpPlugins_OS_Windows
-# define cpPlugins_STRTOK( A, B, N ) strtok_s( A, B, N )
-#else // cpPlugins_OS_Windows
-# define cpPlugins_STRTOK( A, B, N ) std::strtok( A, B )
-#endif // cpPlugins_OS_Windows
-
-// -------------------------------------------------------------------------
-std::vector< std::string > cpPlugins::OS::String::
-Tokenize( const std::string& str, const std::string& delims )
-{
- std::vector< std::string > tokens;
- if( str.size( ) > 0 )
- {
- auto ssize = str.size( );
- char* buffer = new char[ ssize + 1 ];
- for( unsigned long i = 0; i < ssize; ++i )
- buffer[ i ] = str[ i ];
- buffer[ ssize ] = '\0';
- char* next;
- char* it = cpPlugins_STRTOK( buffer, delims.c_str( ), &next );
- while( it != NULL )
- {
- tokens.push_back( std::string( it ) );
- it = cpPlugins_STRTOK( NULL, delims.c_str( ), &next );
-
- } // elihw
- delete [] buffer;
-
- } // fi
- return( tokens );
-}
-
-// eof - $RCSfile$