开发者

Word wrap in TMemo at a plus (+) char

In my string i have an plus (+) char.

For example, string is

__VIEWSTATE=/wEPDwULLTIwMTY5NDMyMDAPZBYCZg9kFgICAQ9kFgxmD2QWAmYPFgIeC18hSXRlbUNvdW50AgMWBgIBD2QWAmYPFQEiPG5vYnI+PHNwYW4+0JLRhdC+0LQ8L3NwYW4+PC9ub2JyPmQCAw9kFgJmDxUBTDxub2JyPjxhIGhyZWY9J3NpZ251cC5hc3B4JyB0YXJnZXQ9J19zZWxmJz7QoNC10LPQuNGB0YLRgNCw0YbQuNGPPC9hPjwvbm9icj5kAgUPZBYCZg8VAUk8bm9icj48YSBocmVmPSdhYm91dC5hc3B4JyB0YXJnZXQ9J19zZWxmJz7QmNC90YTQvtGA0LzQsNGG0LjRjzwvYT48L25vYnI+ZAICD2QWBAIBDxYCHwACBRYKZg9kFgJmDxUBHjxsaT48Yj7QmtC

Now i add line to memo1 and get this:

Word wrap in TMemo at a plus (+) char

Delphi inserts new line at random places. I`m try to remove 开发者_StackOverflow中文版all lines break:

viewstate:=StringReplace(viewstate, #10#13, ' ', [rfReplaceAll]);
viewstate:=StringReplace(viewstate, #13#10, ' ', [rfReplaceAll]);
viewstate:=StringReplace(viewstate, #10, ' ', [rfReplaceAll]);
viewstate:=StringReplace(viewstate, #13, ' ', [rfReplaceAll]);

But it`s no result. What is it?

P.S. I`m from Russia, so sorry for bad English.


Delphi isn't adding linebreaks. The memo is adding visual soft-breaks at separator characters (such as +). Set the memo's WordWrap property to false and it should resolve the problem.


Just for reference, to wrap text on a specific character you can use the

WrapText() function in the SysUtils.pas unit.

function WrapText(const Line, BreakStr: string; const BreakChars: TSysCharSet;
  MaxCol: Integer): string;

For example:

sOutput := WrapText(sInput,#13#10,['+'],100);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜