splitString() \ Language (API) \ Wiring 1.0 (ALPHA)

| Index

| Reference for Wiring 1.0 (ALPHA) 0022+. 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 |  |
    String str = String("1240,87000,10,30,20,1200");  // the string to split
    Vector <long> numVector;  // long Vector

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

      splitString(str,',',numVector);  // split str using ',' as separator and store the resolt on 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