سؤال

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?

هل كانت مفيدة؟

المحلول

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

NumChars := Length(StringReplace(RichEdit1.Text, sLineBreak, '', [rfReplaceAll]));
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top