Smooth Operator
Smooth Operator

Reputation: 268

Does the Wrap function in ColdFusion insert CR/LFs?

I have the need to do some word wrapping with a few considerations:

  1. Source file is MS WORD

  2. Copy and paste the text into a textarea in a cfform.

  3. Use

    #wrap(theTextVar,80)#
    to dump out the text 80 characters

  4. The text is uploaded to a legacy system which needs ansi or ascii chars uploaded.

Everything seems to work okay, I just wanted to confirm see if anyone else has had luck doing this and if they know if a CR / LF is entered after each line in the outputted text (Step 3)?

Upvotes: 2

Views: 844

Answers (2)

Ben Doom
Ben Doom

Reputation: 7885

From the docs on wrap():

Uses the operating-system specific line break: newline for UNIX, carriage return and newline on Windows.

So if you are doing this on a Windows box, then the answer is yes.

Upvotes: 1

Sergey Galashyn
Sergey Galashyn

Reputation: 6956

Tried this?

<cffile action="write" file="i_will_show_the_secret_if_you_open_me_in_text_editor.html" output="#wrap(theTextVar,80)#" />

Upvotes: 1

Related Questions