How to break up a ColdFusion Variable on a '-' sign.

Posted on 2011-05-04
Last Modified: 2012-06-27
I have variables that contain '-'. Example, the variable #unitName# is ADM-OPS-ITS-IS-AED. I want to force a line break after the hyphens... How would I do this?
Question by:traport
    LVL 51

    Expert Comment

    Try listChangeDelims

    <cfset unitName = "ADM-OPS-ITS-IS-AED">
    #listChangeDelims(unitName, "<br>", "-")#

    Author Comment

    That is almost what I want. I don't want to lose the -, I just want to <br> after it. Thank you!
    LVL 51

    Accepted Solution

    Ok. Just add a "-" before the "<br>"

    #listChangeDelims(unitName, "-<br>", "-")#

    Author Closing Comment

    Thank you!

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    This article  is about submitting  form through  ColdFusion.Ajax.submitForm to the action page and send a response back in JSON format which later can be decoded using ColdFusion.JSON.decode. By this way you can avoid the usual page refresh for subm…
    Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    755 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

    19 Experts available now in Live!

    Get 1:1 Help Now