0

我想将一个大文本字符串发送到剪贴板以粘贴到不同的应用程序中。在字符串中有一些新的行标签\n。如果我将字符串发送到 Flash 中的动态文本字段,它工作得很好,但是如果我将字符串复制到剪贴板并从那里粘贴到记事本中,则换行符不起作用。

有什么建议么?

例子:

var output:String;
output = "This is the first line" + "\n" + "This is the second line";
System.setClipboard(output);

谢谢

4

1 回答 1

0

用正则表达式替换它们:

var reg:RegExp = new RegExp("\n", "gi");
newString = inputString.replace(reg, "\r\n");
于 2013-07-02T16:29:45.130 回答