#include <Arduino.h>
String Imported_Files = "path/to/file1:123\npath/to/file2:456\npath/to/file3:789\n";
int Imported_Files_Count = 3; // Number of lines in Imported_Files
void setup() {
Serial.begin(115200);
// Split the string by '\n' and store lines in an array
String lines[Imported_Files_Count];
int currentLine = 0;
int startIndex = 0;
while (true) {
int endIndex = Imported_Files.indexOf('\n', startIndex);
if (endIndex == -1) break;
lines[currentLine] = Imported_Files.substring(startIndex, endIndex);
startIndex = endIndex + 1;
currentLine++;
}
// Extract the paths and line numbers in reverse order
Serial.println("Paths and line numbers in reverse order:");
for (int i = Imported_Files_Count - 1; i >= 0; i--) {
int colonIndex = lines[i].lastIndexOf(':');
String path = lines[i].substring(0, colonIndex);
String lineNumber = lines[i].substring(colonIndex + 1);
Serial.print("Path: ");
Serial.print(path);
Serial.print(", Line number: ");
Serial.println(lineNumber);
}
}
void loop() {
// put your main code here, to run repeatedly:
}
esp:0
esp:2
esp:4
esp:5
esp:12
esp:13
esp:14
esp:15
esp:16
esp:17
esp:18
esp:19
esp:21
esp:22
esp:23
esp:25
esp:26
esp:27
esp:32
esp:33
esp:34
esp:35
esp:3V3
esp:EN
esp:VP
esp:VN
esp:GND.1
esp:D2
esp:D3
esp:CMD
esp:5V
esp:GND.2
esp:TX
esp:RX
esp:GND.3
esp:D1
esp:D0
esp:CLK