Please Help me with my code

Hello,
Here is a code for reading an RFID chip that i got from the Internet

#include <SPI.h>
#include <MFRC522.h>
 
#define SS_PIN 10
#define RST_PIN 9
MFRC522 mfrc522(SS_PIN, RST_PIN);   // Create MFRC522 instance.
 
void setup() 
{
  Serial.begin(9600);   // Initiate a serial communication
  SPI.begin();      // Initiate  SPI bus
  mfrc522.PCD_Init();   // Initiate MFRC522
  Serial.println("Approximate your card to the reader...");
  Serial.println();

}
void loop() 
{
  // Look for new cards
  if ( ! mfrc522.PICC_IsNewCardPresent()) 
  {
    return;
  }
  // Select one of the cards
  if ( ! mfrc522.PICC_ReadCardSerial()) 
  {
    return;
  }
  //Show UID on serial monitor
  Serial.print("UID tag :");
  String content= "";
  byte letter;
  for (byte i = 0; i < mfrc522.uid.size; i++) 
  {
     Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
     Serial.print(mfrc522.uid.uidByte[i], HEX);
     content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "));
     content.concat(String(mfrc522.uid.uidByte[i], HEX));
  }
  Serial.println();
  Serial.print("Message : ");
  content.toUpperCase();
  if (content.substring(1) == "BD 31 15 2B") //change here the UID of the card/cards that you want to give access
  {
    Serial.println("Authorized access");
    Serial.println();
    delay(3000);
  }
 
 else   {
    Serial.println(" Access denied");
    delay(3000);
  }
}

And i want the code to show me the cards Number only once when i go over it and keep it on the Sensor so i dont recieve the Cards UID every 1 second on my Serial Monitor.
I want the Code to be built the way that it compares the old value and if it gets a Positive result ( identical Number) i want it to say "remove card" only once and wait for an another Card.

I have tried to campare content.substring(1)) with content.substring(1)) but thats nonsense or is it? i dont know. Im confused. I have tried the infinite While loop and the If Loop but didnt work.
So plz help me

Here is a very bad google translation.

Good day
I have here a code for reading an RFID chip from the Internet

And I want that when I go over the sensor with my card that result is displayed only once and then compares the old value with the newly scanned and dan decides whether he then spends "remove the card" and wait for the card to be removed or the new e card.

I tried to compare it with the content.substring(1)) but don't know where it is in the code and works. I also tried the if loop but he stays only 1 times in the loop somehow so I tried the infinite while loop. Unsuccessful.

Ask for help.

if you want i can translate this topic to english

Osu:
if you want i can translate this topic to english

The google translate did a good enough job. I do not have any experience with RFID so I am unable to help. However, many people on this site do work with these devices and I suspect someone will help.

If your loop is exiting than it is a result of one of these 2 sections of code.

Put print statements in both of these to see what call is failing. You should not need an endless loop as loop is endless.

if ( ! mfrc522.PICC_IsNewCardPresent()) 
  {
    return;
  }
  // Select one of the cards
  if ( ! mfrc522.PICC_ReadCardSerial()) 
  {
    return;
  }

Hallo Osu
Im deuschen Teil des Forums darfst Du auch Deutsch schreiben.
Grüße Uwe