void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
String AllPath = "/Root/111/222/333/444";
String NewPath;
String NewDir;
NewPath = AllPath;
NewDir = AllPath;
String TAG = "/";
int Pos1 = NewPath.lastIndexOf(TAG);
int Pos2 = NewPath.length();
NewPath.remove(Pos1, Pos2 - Pos1);
NewDir.remove(0, Pos1 + 1);
Serial.println("AllPath: " + AllPath);
Serial.println("NewPath: " + NewPath);
Serial.println("NewDir: " + NewDir) ;
}
void loop() {
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
}