一段代码,可以把QQ里边复制出来的文字中小黑方块变成正常的换行
procedure ConvertQQMsg(Lines: TMemo);
var
TmpStrList: TStrings;
begin
TmpStrList := TStringList.Create;
try
TmpStrList.Text := Lines.Lines.Text;
TmpStrList.Delimiter := #13;
Lines.Lines.DelimitedText := TmpStrList.DelimitedText;
finally
TmpStrList.Free;
end;
end;
研究半天,没看懂那个DelimitedText是什么意思.........
这格式帮助里边的解释
Descriptio
Use DelimitedText to get or set all the strings in the TStrings object in a single string.
When reading DelimitedText, the resulting value delimits individual strings in two ways: each string is surrounded (before and after) by the quote character specified by the QuoteChar property. In addition, individual strings are separated by the character specified by the Delimiter property.
When writing DelimitedText, individual strings must be separated using QuoteChar at both ends, using Delimiter as a separator, or using both these methods.
Note: CommaText is the same as the DelimitedText property when Delimiter is ',' and QuoteChar is '"'.
大概是DelimitedText在Read时候会把TSTringList里边的Text的多行文字按两种方式组合,一是用quoteChar里边的东西把每行东西 二是用Delimiter里边的东西把每行分开.....但是实际试验似乎不是这样的..........
拿这几句try了一下
Memo1.Lines.Delimiter:=';';
Memo1.Lines.QuoteChar:='~';
Memo2.Lines.Add(memo1.Lines.DelimitedText)
大概的结论:
换行会被;隔开,但是最后一行除外 如果这行有; 那么这行会被~引起来(包括;) 如果这样有~ 那么这行会被n个~成n+1段,每段用~引起来
write应该就是反过来
结论是 这东西用于把单行文字变成多行文字或者相反
那段代码的意思是,qq复制下来的东西是以#13为分割的单行文字,所以把tem的delimited设置成#13
然后再转成多行
不过总觉得那段代码是有问题的,Read"TmpStrList.DelimitedText"的时候会自动在字符串两边加上QuoteChar.........
研究了半天
Memo2.Lines.Delimiter:=#65;
Memo2.Lines.DelimitedText:=Memo1.Lines.Text;
这个倒是可以把'A'改成换行