libStatGen Software  1
String.cpp
00001 /*
00002  *  Copyright (C) 2010  Regents of the University of Michigan
00003  *
00004  *   This program is free software: you can redistribute it and/or modify
00005  *   it under the terms of the GNU General Public License as published by
00006  *   the Free Software Foundation, either version 3 of the License, or
00007  *   (at your option) any later version.
00008  *
00009  *   This program is distributed in the hope that it will be useful,
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *   GNU General Public License for more details.
00013  *
00014  *   You should have received a copy of the GNU General Public License
00015  *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 
00018 #include <iostream>
00019 
00020 #include "String.h"
00021 #include <vector>
00022 
00023 #ifdef OBSOLETE
00024 
00025 std::vector<csg::string> *csg::string::split(char splitChar)
00026 {
00027     std::vector<csg::string> *result = new std::vector<csg::string>;
00028     csg::string word;
00029 
00030     for (size_t i = 0; i<size(); i++)
00031     {
00032         if ((*this)[i]==splitChar)
00033         {
00034             result->push_back(word);
00035             word.clear();
00036         }
00037         else
00038             word.push_back((*this)[i]);
00039     }
00040     if (word.size()>0) result->push_back(word);
00041     return result;
00042 }
00043 
00044 
00045 #if defined(TEST)
00046 
00047 int main(int argc, const char **argv)
00048 {
00049     csg::string string("abcdef:abcdefghijk");
00050 
00051     std::vector<csg::string>    *result = string.split(':');
00052 
00053     for (int i=0; i<result->size(); i++)
00054     {
00055         std::cout << i << "\t" << (*result)[i] << std::endl;
00056     }
00057     delete result;  // suck
00058 
00059 }
00060 #endif
00061 
00062 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends