How can I write a newline in a string in ColdFusion?

前端 未结 7 946
孤街浪徒
孤街浪徒 2021-02-03 20:58

Currently I\'m putting newlines in strings through one of these two methods:



        
7条回答
  •  太阳男子
    2021-02-03 21:27

    Not directly in CF, I'll leave it to the CF-Java dudes to say whether you can use a Java method directly on a CF var to achieve what you want, but...

    You could use cfsavecontent to put natural line breaks in:

    
    This is line 1
    This is line 2
    This is line 3
    
    

    Then check it with:

    
    
    #Trim(someStr)#

    Note that the Trim() is there to get rid of the first and last line breaks if you don't want them.

提交回复
热议问题