Do I need Chr(10) with Chr(13)?

Posted on 2006-04-30
Last Modified: 2013-12-24
I'm converting the commas in a list to line breaks (for display in a textarea) this way:

<cfset newlist2 = listChangeDelims(newlist,"#chr(13)#")>

Is it necessary to include chr(10) as well, like this:

<cfset newlist2 = listChangeDelims(newlist,"#chr(10)##chr(13)#")>

When I do that I get double-spaced lines in the textarea, which I'd rather not have.
Question by:brucecrabtree
    LVL 7

    Expert Comment

    It really depends on the OS of the user viewing the textarea.  Just so you know, it's a combination of Chr(13) followed by a Chr(10), not the other way around.  Also, ListChangeDelims() does the very same thing as Replace().  Consider the following:

      newlist = 'foo,bar,boo,far,goo,car,coo,gar';
      newlist_listchangedelims = ListChangeDelims(newlist, Chr(13) & Chr(10));
      newlist_replace = Replace(newlist, ',', Chr(13) & Chr(10), 'ALL');
      #WriteOutput(newlist_listchangedelims EQ newlist_replace)#
    LVL 7

    Expert Comment

    Just use the chr(13) and if you get what you want then it is OK.  The line breaks are coming from the extra char(10).
    LVL 7

    Expert Comment

    Using just Chr(13) isn't going to get the job done.  Some operating systems need the Chr(10) to display things properly.
    LVL 7

    Accepted Solution

    In fact, the extra line break is because of the incorrect sequence of Chr(10) Chr(13) when it *should* be Chr(13) Chr(10).

    Author Comment

    Thanks Jeff. Is Replace() better than listChangeDelims ?
    LVL 7

    Expert Comment

    It's not so much that it's better, it's that sometimes it'll yield more consistent results.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Suggested Solutions

    Article by: kevp75
    Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
    Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now