Reference for Wiring version 0027+. If you have a previous version, use the reference included with your software. If you see any errors or have any comments, let us know.

Name

splitString()

Examples
// the string to split
String str = String("1240,87000,10,30,20,1200");  
Vector < long > numVector;  // long Vector

void setup() {
  Serial.begin(9600); 
  pinMode(48, OUTPUT);
  // turn ON the wiring board LED
  digitalWrite(48, HIGH);

  // split str using ',' as separator and store the resolt on numVector
  splitString(str,',',numVector);  
  for(int i=0; i < numVector.size(); i++) { 
    // print the contents of numVector 
    Serial.println(numVector.get(i), DEC);
  }
}

void loop() {
  
}
Description Splits a string around matches of the given delimiter char and returns the result in a Vector. The string to split must be made in the format in the example: "numeric value 1'delim'numeric value 2'delim'...'delim'numeric value n".
Syntax
splitString(data, delim, result)
Parameters
data String: the string to split
delim char: the char used as delimiter
result Vector: vector of int or long numbers with the result
Returns none
Usage Application
Related String
Vector
Updated on September 17, 2010 01:38:09pm PDT

Creative Commons License