#include <vector>
 // Diese Funktion zerlegt einen String in Teilstrings anhand eines Trennzeichens
std::vector<std::string> splitString(std::string s, std::string delimiter) {
  std::vector<std::string> result;
  size_t pos = 0;
  std::string token;
  while ((pos = s.find(delimiter)) != std::string::npos) {
    token = s.substr(0, pos);
    result.push_back(token);
    s.erase(0, pos + delimiter.length());
  }
  result.push_back(s);
  return result;
}

void setup() {
  Serial.begin(115200);
  testSplit("12,sadsa,asdsad,sadsad,sad,sad", " ");
  testSplit("12,sadsa,asdsad,sadsad,sad,sad", ",");
}

void loop() {
  // put your main code here, to run repeatedly:
  delay(10); // this speeds up the simulation
}

void testSplit(std::string value,std::string delimiter ){
      std::vector<std::string> parameters = splitString(value, delimiter);
      for (int i = 0; i < parameters.size(); i++) {
        Serial.print("Parameter empfangen");
        Serial.print(i + 1);
        Serial.print(": ");
        Serial.println(parameters[i].c_str());
    }
}