AS3将TextField换行符转换为CRLF,以便在Windows上显示为纯文本(记事本)
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了AS3将TextField换行符转换为CRLF,以便在Windows上显示为纯文本(记事本)相关的知识,希望对你有一定的参考价值。
Linebreaks differ between Flash TextField and a plain text file like Notepad. In this example we convert the html linebreaks in Flash to
var originalStr:String = "<p>Each<br>word<br>should<br>be<br>on<br>a<br>new<br>line.</p><p> This line should be tabbed.</p><p>But this line shouldn't be tabbed.</p><p><li>Bullet points don't work though</li><li>Bullet points don't work though</li><li>Bullet points don't work though</li></p><p>Paste into Notepad to view the results!</p>"; var textfieldStr:String = unescape(originalStr); var tf:TextField = new TextField(); tf.multiline = true; tf.width = stage.stageWidth; tf.height = stage.stageHeight; addChild(tf); tf.htmlText = textfieldStr; var clipboardForNotepadStr:String = unescape(tf.text.replace(/ /g, ' ')); System.setClipboard(clipboardForNotepadStr);
以上是关于AS3将TextField换行符转换为CRLF,以便在Windows上显示为纯文本(记事本)的主要内容,如果未能解决你的问题,请参考以下文章
git转换换行符LF与CRLF转换问题-Windows系统和Linux系统差异统一