Clearing a display.print(" xxx"); from Giga display/Giga R1

Well, hello to all the Giga R1 folks. I have an easy question for someone please. I'm new to the Gigs R1 with display. I have a bunch of the code working. But I am baffled at how to clear a display.print message that I put on the Giga touch display. Ill include some of my code and explain. This is probably going to be easy and I'm going to look like a dummy as usual.

while (status != WL_CONNECTED && connected == false) // attempting to connect to WiFi network:
{
status = WiFi.begin(ssid, pass);
display.setCursor(275,420); //x,y
display.setTextSize(3); //adjust text size
display.setTextColor(WHITE);
display.print("Attempting WiFi Connection"); //This works fine
Attempts ++;
Serial.println(Attempts);
if (Attempts >= 2)
{
connected = true;// a boolean exp I set as false at the beginning
rgb.on(255,0,0); //turn on the red LED to show that the WiFi failed to connect
display.setCursor(275,420); //x,y location
display.setTextSize(3); //adjust text size
display.setTextColor(RED);
display.print("WiFi Not Connected"); //print this in the x,y location

This last line of code prints "WiFi Not Connected" as expected, but above I'm having the display show "attempting wifi connection" in the same exact x,y location and the display just kinds pastes the two over each other. How do I clear the last display.print so that only the new display .print shows.
Thank you for your help.
As always I appreciate your expertise and apologies for my ignorance. Im still learning

You can print spaces in the background colour over the existing text before printing the new text or print the existing text in the background colour before printing the new text

Use the display.fillScreen(uint16_t color) function to clear the screen.
For example, use display.fillScreen(0) to change the screen color to black.

I deliberately did not suggest the use of the fillScreen() function because at best it leads to flickering of the screen and, of course, if other data is already on the screen you need to print it again after clearing it

There is a good recent thread talking about flicker and the like that @ptillisch posted some good information in a response:

But assuming you are using Adafruit GFX and the system font, what you probably
are wanting to do is use opaque text output.

You set that up on the setTextColor line, with a second color, which is used when
the font character you are outputting does not set that pixel on.

Something like: display.setTextColor(RED, BLACK);
Assuming you background is BLACK...

Note: If your new output text is shorter than the previous output, this will not overwrite
the characters at the end. There are several possible ways to do this, like
simply output some additional blank characters. I would try this first!

Another approach is to use a fillRect with the background color to fill in the rest, warning typing on fly so maybe typos or names of functions wrong.

    display.print("WiFi Not Connected");
    int x =  tft.getCursorX();
    tft.fllRect(x, <Y start>, <width to fill>, <height to fill>, BLACK);

Some of these fields you may need to play with,
like I would start at your 420
Width: if nothing else displayed in same line, could be: display.width() - x;
HEIGHT: I think fonts are 6x8? you are using size 3, so probably try 24...
Alternatively, you could use getTextBounds to compute this:

void getTextBounds(const char *string, int16_t x, int16_t y, int16_t *x1,
                     int16_t *y1, uint16_t *w, uint16_t *h);

You can ask for the bounds of strings you output and if the width of the
last one you output is smaller than the width of the previous one, you could
fillRect the difference. Hope that makes sense.

Good luck

Thank you all for the responses. Looks like I have several options. Again thank you. I’m sure one of them will work for me.