Lenght(); returning 2 longer than the input

Ok so I am working on an in curcuit EEprom programmer using an uno. I've got a weird issue. I want to verify a string sent to the uno is the correct length before it moves on the next step of writing that string to the eeprom.

here is where I am

void loop(){

  if(Serial.available() > 0)
  { 
    char letter = Serial.read();
   if(letter == '1'){
//do eeprom reading stuff
}

  else if(letter == '2')
{
  Serial.print("paste bin in the next 5 seconds");
    String s1 = Serial.readString();// s1 is String type variable.
    int s1Length = s1.length(); // makes lenght
     Serial.print(s1Length);
    Serial.print(s1);//display same received Data back in serial monitor.
    delay(500);
}
}

output from monitor 
paste bin in the next 5 seconds6
20:36:26.574 -> 1234

the 6 after seconds is the output length and I sent "1234" I cut out all the eerom read stuff and void setup.

once I get the whole thing working I am not going to have it print the value just flash the EEprom if its 512 characters long.

Always post all your code.

Avoid use of Strings, as they cause unpredictable crashes on AVR-based Arduinos.

Don't forget that the serial monitor optionally sends line feed, carriage return, etc.

Full code

#include <SPI.h>
#define csPIN 10

//opcodes
#define WREN  6
#define WRDI  4
#define RDSR  5
#define WRSR  1
#define READ  3
#define WRITE 2

// start of SPI read
uint8_t readByteAt(uint8_t cs,uint16_t adr){
SPI.beginTransaction(SPISettings(4000000,MSBFIRST,SPI_MODE0));
digitalWrite(cs,LOW);
uint8_t b=highByte(adr);
b = b <<3;  //move address bit 8 to bit 11
b = b | READ;  // read command
SPI.transfer(b); // send cmd + address bit 8
SPI.transfer(lowByte(adr)); // low byte of address
b= SPI.transfer(0); // read the actual byte
digitalWrite(cs,HIGH); //
SPI.endTransaction();
return b;
}
//end

void setup(){
Serial.begin(9600);
digitalWrite(csPIN,HIGH);
pinMode(csPIN,OUTPUT);
SPI.begin();
Serial.setTimeout(5000); //sets wait time
}


void loop(){

  if(Serial.available() > 0)
  { 
    char letter = Serial.read();

    if(letter == '1')
    {
char ch[30];
for (uint16_t i=0;i<256;i++){       //how deep to read 
 
  sprintf(ch,"%02X",readByteAt(csPIN,i));
  Serial.print(ch);
  }
  delay(5000); 
}


  else if(letter == '2')
{
  Serial.print("paste bin in the next 5 seconds");
  String s1 = Serial.readString();// s1 is String type variable.
    int s1Length = s1.length(); // makes length
     Serial.print(s1Length);
    Serial.print(s1);//display same received Data back in serial monitor.
    delay(500);
}}
delay(10);
  }

Edit maybe I should use Serial.readBytes()?

Why does the "full code" have so little to do with the snippet you posted?

Please explain the real problem you are having.

well the real code is done with the read function of the eeprom programmer and 1% done with the write function. right now if you send 1 it will dump the eeprom and if you send 2 it will ask you send the dump you want to flash. you send it and then once I get that point it will write it to the eeprom I am still learning how to do that. I mean if you want to take that on that would be awesome because I am not a programmer haha. I do want to learn how so I don't actually want the code done for me.

Right now when I send it the dump I want to flash the string is 2 characters longer than it should be according lenght() so I haven't pushed past that until I figure out where that is coming from.

until I figure out where that is coming from

See last line of reply #1.

Ah you are right I had New line on... I need to take a break I should have noticed that. I saw what you said but I made an idiot of myself and didn't look.