void testF() {
  float letterX = -2.123;
  float letterY = 7.1;
  float letterZ = 5.7;
  char tempStrX[10];
  char tempStrY[10];
  char tempStrZ[10];
  String Birim = "11";
  int ScaleDeviceIdNo = 0;
  int decimalPoint = 2;
  dtostrf(letterX, 7, decimalPoint, tempStrX);
  dtostrf(letterY, 7, decimalPoint, tempStrY);
  dtostrf(letterZ, 6, decimalPoint, tempStrZ);
  char buf[50];
  //sprintf(printBuffer, strdeger , (String)ScaleDeviceIdNo , Gosterge_flt, (String)ScaleDeviceTare ,ScaleDeviceBrim);
  const char* strdeger =  ( ScaleDeviceIdNo == 0 ? "ST,NT,%7s,T=%7skg" : "%03dST,NT,%7s,T=%7skg");
  //sprintf(buf, "Value: %s, %s, and %s.", tempStrX, tempStrY, tempStrZ);
  //sprintf(buf, "%03dST,NT,%07s,T=%7skg", id, tempStrX, tempStrY);
  if (ScaleDeviceIdNo == 0)
    sprintf(buf, strdeger, tempStrX, tempStrY);
  else
    sprintf(buf, strdeger, ScaleDeviceIdNo, tempStrX, tempStrY);
  Serial.println(buf);
}

void setup() {
  Serial.begin(115200);
  // put your setup code here, to run once:
}

void DisplayGeneral(String stt, bool seri_send){
  Serial.print("sst Ham :");
  Serial.println(stt);
  int Par_WghtStop = 6;
  int Par_WghtStrt = 14;

  String Net_Text = stt.substring(Par_WghtStrt, Par_WghtStop);
  Serial.print("sst :");
  Serial.println(Net_Text);

  int dig_lenght = Par_WghtStrt - Par_WghtStop ;

  Serial.print("dig_lenght :");  Serial.println(dig_lenght);

  int Point = Net_Text.indexOf('.') < 0 ? 8 : (Net_Text.indexOf('.') ) +1;
  Serial.print("indexOf    :");  Serial.println(Point);

  float Net_flot = Net_Text.toFloat();

  char text_Net[10];
  dtostrf(Net_flot, dig_lenght, dig_lenght - (Point) , text_Net);
  Serial.print("text_Net   :"); Serial.println(text_Net);

  Serial.print("text_Net   :"); Serial.println(text_Net);
}

float flt_Nets =-2.25;
float flt_Tare =11.11;
int dig_lenght = 7 ;
int Par_Point = 2;

const char* g_RaporST1Return() {
 static char crap[50];
 
  // sprintf(crap, "ST,NT,%-8s,T=%-7s,%s\r\n", 
  // TscRp80VI::_varStr[TscRp80VI::_38_Net].c_str(),
  // TscRp80VI::_varStr[TscRp80VI::_37_Tara].c_str(),
  // Sys_Variable::ScaleDeviceBrim.c_str() );//_SystemOparator[1].c_str() ); 

  //ST,NT,-0024.95,T=0001.76,kg
  char tareFormatted[8];
  char netFormatted[9];
  dtostrf(flt_Nets , dig_lenght + (flt_Nets < 0 ? 1 :0), Par_Point, netFormatted);
  dtostrf(flt_Tare , dig_lenght, Par_Point, tareFormatted);

    // netFormatted string'i içindeki tüm '-' işaretlerini kaldır
    char* dashPos = strchr(netFormatted, '-');
    while (dashPos != nullptr) {
        memmove(dashPos, dashPos + 1, strlen(dashPos));
        dashPos = strchr(netFormatted, '-');
    }


    for (int i = 0; i < 8; ++i) {
        if (netFormatted[i] == ' ') {
            netFormatted[i] = '0';
        }
        if (tareFormatted[i] == ' ') {
            tareFormatted[i] = '0';
        }

    }
    //     for (int i = 0; i < 7; ++i) {
  
    //     if (tareFormatted[i] == ' ') {
    //         tareFormatted[i] = '0';
    //     }

    // }
  
    //   // Eğer tareFormatted string'inin herhangi bir yerinde '-' karakteri varsa, onu kaldır
    // char* dashPos = strchr(tareFormatted, '-');
    // if (dashPos != nullptr) {
    //     memmove(dashPos, dashPos + 1, strlen(dashPos));
    // }
//ST,NT,-0048.22,T=0004.35,kg
//ST,NT,-0052.58,T=0004.83,kg
//ST,NT,-0012.25,T=00011.11,kg
  sprintf(crap, "ST,NT,%s%7s,T=%7s,kg\r\n",
  (flt_Nets > 0 ? "+" :"-"),
  netFormatted,
 // netFormatted,
 tareFormatted
 );//_SystemOparator[1].c_str() ); 
   return crap;
}


void loop() {
  //DisplayGeneral("ST,NT,+008124,T=000.853,kg", true);
  Serial.println(g_RaporST1Return() );
  //testF();
  //delay(500);
  while (2);
}