Serial.print int divided with dot

Hi, I would print on a TFT little screen a number separated with dot. For example:
1234567 -> 1.234.567
Can someone help me?
Thank

Doesn't Google work where you are?

Sorry I cannot answer that as I do not know what type of number you are talking about. A float will normally print that way, an int will not.

You could hack your way to it, like so...

void setup() {
  
  Serial.begin(115200);
  uint32_t num = 1234567;
  
  Serial.print(num / 1000000);
  Serial.print(".");
  num = num % 1000000;
  Serial.print(num / 1000);
  Serial.print(".");
  Serial.println(num % 1000);
  
}

void loop() {
  // put your main code here, to run repeatedly:

}

Gives 1.234.567 in serial monitor

Update Edit:

@stevetdr

The above doesn't work properly with numbers containing zero's
This solves that issue



char numStr[10];
uint32_t num;

void numToStr () {

  ultoa(num, numStr, 10);
  uint8_t len = strlen(numStr);
  for (uint8_t n = 1; n <= len; n ++) {
    Serial.print(numStr[n - 1]);
    if (n != len && (len - n) % 3 == 0) Serial.print(".");
  }
  Serial.println();
}


void setup() {
  
  Serial.begin(115200);

  randomSeed(analogRead(0));
 
}

void loop() {
  
  num = random(1000000, 100000000);
  Serial.println(num);  
  numToStr();
  delay(500);

}

Try it in Wokwi...

With all your suggestion I solved the problem. Thank

Tested, perfect. I programmed a pesonal loooooooong program. Your is best and, I suppose, fastest. Thank again.