RuiViana

Separa.ino

Jan 28th, 2019
234
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. String abc = "?ip=172.75.1.99&";
  2. //-------------------------------------------------------
  3. void setup() {
  4.  
  5.   Serial.begin(115200);
  6.   int posicao;
  7.   String temp = abc;
  8.   int num[4] ;
  9.  
  10.   posicao = temp.indexOf(".");
  11.   num[0] = temp.substring(4, posicao).toInt();
  12.   temp = temp.substring(posicao + 1, 20 );
  13.   for (int i = 1; i < 4; i++)
  14.   {
  15.     posicao = temp.indexOf(".");
  16.     num[i]  = temp.substring(0, posicao).toInt();
  17.     temp = temp.substring(posicao + 1, 20 );
  18.   }
  19.   for (int i = 0; i < 4; i++)
  20.   {
  21.     Serial.println(num[i] );
  22.   }
  23. }
  24.   void loop() {
  25.     // put your main code here, to run repeatedly:
  26.  
  27.   }
RAW Paste Data