Text added letter by letter

Hey, so here is a quick sketch as an example. I have added text to the screen all at once, just wondering if its possible to make the text appear letter by letter on the screen and how would this be achieved? Thanks.


void setup(){
  
  size(600,600);
  
}


void draw(){
  
  background(0);
  
  
   
    PFont a = createFont("Times New Roman Bold", 64);


    String b = "EXCERSIZE";
    textAlign(CENTER);
    textFont(a); 
    fill(255);
    textSize(68);
    text(b, width/2, height/2);
  
  
}

Here is one way


void setup() {
  size(600, 600);
}

int index = 0;

void draw() {
  background(0);
  PFont a = createFont("Times New Roman Bold", 64);
  String b = "EXCERSIZE";
  textAlign(CENTER);
  textFont(a); 
  fill(255);
  textSize(68);
  text(b.substring(0, index), width/2, height/2);

  if (frameCount % 15 == 0) {
    index = min(index+1, b.length());
  }
}

Another way (and I leave that an exercise for you) would be to have another String in the global scope.

String display = "";

Then from the b string you keep adding chars using b.charAt(some_index).