LCL, Translations unit: Improved lieending removal code clarity, added more comments.

git-svn-id: trunk@52700 -
This commit is contained in:
maxim 2016-07-16 10:22:01 +00:00
parent 96b2691e94
commit 3bb3ac5dff

View File

@ -1168,14 +1168,18 @@ begin
end else
Result:=OriginalValue;
//Remove lineending at the end of the string if present.
//This is the case e.g. for multiline string and not desired when assigning e.g. to
//This is the case e.g. for multiline strings and not desired when assigning e.g. to
//Caption property (can negatively affect form layout). In other cases it should not matter.
l:=Length(Result);
if l>1 then
begin
//Every string with #13 and/or #10 character at the end was treated as multiline, this means that
//extra lineending could have been added to it.
if RightStr(Result,2)=#13#10 then
begin
if l>2 then //do not leave the string empty
SetLength(Result,l-2)
SetLength(Result,l-2);
end
else
if (Result[l]=#13) or (Result[l]=#10) then
SetLength(Result,l-1);