Get image number and looping number from filename parameters

i want to give four digit name of an image like 0102. where two digit define image number and other two define looping time of image . is this is possible to get parameter from image name and use it in looping and other variables.

import processing.serial.*;

Serial myPort; 
int n,dataIn;
int maxImages = 5;
 int imageIndex = 0; 
PrintWriter output;
int i, j, k;
int a=20;
String s, p;
void setup()
{

  size(100, 100);

  output = createWriter("a.txt");
  myPort = new Serial(this, "COM6", 38400);
    
      PImage[] images = new PImage[maxImages];     
      
      for ( j=0;j<images.length;j++) 
      {
      images[j] = loadImage(j+".png");
      frameRate(1);
      images[j].loadPixels();
         imageIndex = (imageIndex + 1) % images.length;     
      }
      

  
}

void draw()
{

  function();
  //image(images[j], 0, 0);  

}




where j value is define image number and this code run images from 0 to 100.I want to given loop number in image but i don’t know how to do it in my code.
please share your ans. thanks in advance .

1 Like

Research:
https://processing.org/reference/nf_.html
https://processing.org/reference/addition.html

This also works for 0 to 99:

:slight_smile:

1 Like