]> git.donarmstrong.com Git - mothur.git/commitdiff
modified splitAtComma in mothurout command
authorpschloss <pschloss>
Thu, 26 Aug 2010 20:15:27 +0000 (20:15 +0000)
committerpschloss <pschloss>
Thu, 26 Aug 2010 20:15:27 +0000 (20:15 +0000)
mothurout.cpp

index 5c5fd373a32cbb233fb9a76dd81de87c54cb80eb..fe3ea097e64faf1b0418f22fa3b248b026ad4dd1 100644 (file)
@@ -1179,17 +1179,33 @@ void MothurOut::splitAtDash(string& estim, set<int>& container) {
 //This function parses the a string and puts peices in a vector
 void MothurOut::splitAtComma(string& estim, vector<string>& container) {
        try {
-               string individual;
-               
-               while (estim.find_first_of(',') != -1) {
-                       individual = estim.substr(0,estim.find_first_of(','));
-                       if ((estim.find_first_of(',')+1) <= estim.length()) { //checks to make sure you don't have comma at end of string
-                               estim = estim.substr(estim.find_first_of(',')+1, estim.length());
+               string individual = "";
+               int estimLength = estim.size();
+               for(int i=0;i<estimLength;i++){
+                       if(estim[i] == ','){
                                container.push_back(individual);
+                               individual = "";                                
+                       }
+                       else{
+                               individual += estim[i];
                        }
                }
-               //get last one
-               container.push_back(estim);
+               container.push_back(individual);
+               
+               
+               
+               
+//             string individual;
+//             
+//             while (estim.find_first_of(',') != -1) {
+//                     individual = estim.substr(0,estim.find_first_of(','));
+//                     if ((estim.find_first_of(',')+1) <= estim.length()) { //checks to make sure you don't have comma at end of string
+//                             estim = estim.substr(estim.find_first_of(',')+1, estim.length());
+//                             container.push_back(individual);
+//                     }
+//             }
+//             //get last one
+//             container.push_back(estim);
        }
        catch(exception& e) {
                errorOut(e, "MothurOut", "splitAtComma");