Im counting characters of a message from a textbox that will be sent as an sms, I've noticed that txtBody.Text.Length is counting more characters for returns, understand i want to keep the formatting of a newline but .net is counting 2 characters for this is there any way to keep the new line but get the counter to be accurate or is a return itself 2 characters ???
The newline in windows is indeed 2 characters - CrLf - ASCII 13 followed by ASCII 10.
You can simply decrement 2 from the returned Length, or get a count of all Environment.NewLine, double that by 2 and decrement from the Length.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With