2

I have problem with counting characters in richedit (Delphi XE). For every new line as a result i get two characters more but in text they not exists.

Example: Here are 15 characters, but richedit gives 17 because of new line.

line zero
line one

Is there solution for this?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Srdjan
  • 23
  • 3
  • Welcome to SO! You might get more replies and upvotes if you edit your question to include a code snippet to show how you're counting the characters currently. (In general if you have a problem, it's normally best to show what you're currently doing as well as what the problem is.) – David Jul 28 '11 at 03:52

1 Answers1

2

Remove CR/LFs and get the count of the remaining characters. An example:

NumChars := Length(StringReplace(RichEdit1.Text, sLineBreak, '', [rfReplaceAll]));
Sertac Akyuz
  • 54,131
  • 4
  • 102
  • 169