#include "StringVector.h" StringVector::StringVector (std::string AInput, std::string ADelimiter) { SetInput (AInput); SetDelimiter (ADelimiter); } std::string StringVector::GetString (void) { std::string::size_type Pos; std::string AString; Pos = Input.find_first_of(Delimiter.c_str(), StartPos); if (Pos-StartPos == 0) { //first value at StartPos is a Delimiter StartPos += 1; return ""; } else if (Pos != std::string::npos){ // a delimiter was found after StartPos AString = Input.substr(StartPos, Pos-StartPos); StartPos = Pos + 1; return AString; } else { //no delimiter was found after StartPos AString = Input.substr(StartPos, Pos-StartPos); StartPos = Pos; return AString; } } std::vector StringVector::GetStringVector(void) { StartPos = 0; std::string Value; ResetVector(); while (StartPos != std::string::npos){ Value = GetString(); if (Value.length() > 0) Strings.push_back(Value); } return Strings; }