使用 Coldfusion 在记事本中换行
我无法说服为什么我不能用 Coldfusion 在记事本中换行。
这是我的编码,
<cfscript>
msg = "ppshein<CR>Coldfusion Developer<CR>Currently working in Singapore";
currentPath = getCurrentTemplatePath();
currentDirectory = getDirectoryFromPath(currentPath);
chgMsg = ReReplace(msg, "<CR>", "<CR>\r\n", "ALL");
FileWrite("#currentDirectory#\myfile.txt", "#chgMsg#");
return "successfully generated";
</cfscript>
我在上面运行的编码并打开 myfile.txt,它发生了,所以
ppshein<CR>Coldfusion Developer<CR>Currently working in Singapore
我想要的是
ppshein<CR>
Coldfusion Developer<CR>
Currently working in Singapore
任何评论将不胜感激。
I cannot convince why I cannot break line in notepad with coldfusion.
Here is my coding
<cfscript>
msg = "ppshein<CR>Coldfusion Developer<CR>Currently working in Singapore";
currentPath = getCurrentTemplatePath();
currentDirectory = getDirectoryFromPath(currentPath);
chgMsg = ReReplace(msg, "<CR>", "<CR>\r\n", "ALL");
FileWrite("#currentDirectory#\myfile.txt", "#chgMsg#");
return "successfully generated";
</cfscript>
what I run above coding and open myfile.txt, it happen so
ppshein<CR>Coldfusion Developer<CR>Currently working in Singapore
What I want is
ppshein<CR>
Coldfusion Developer<CR>
Currently working in Singapore
Any comments will be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不要认为这里需要 ReReplace,而且您的替换字符串不正确——CF 无法识别这种格式。试试这个:
UPD。让我尝试稍微优化整个代码块......
更干净且易于阅读。
Don't think you need ReReplace here, plus your replacement string is incorrect -- CF does not recognize this format. Try this one:
UPD. Let me try to optimize whole block of code a bit...
A bit more clean and easy to read.