trimming strings

Posted on 2006-05-22
Last Modified: 2013-12-24
i have some strings

eg. value1_id4

need to pull them into two string like value1 and id4 the _ sign shows where one ends and the other starts. how can i do this? also how can i do this in a query loop (say it i have more than one)?

many thanks

Question by:pigmentarts
    LVL 12

    Author Comment

    ie this value1_id4 to this value1 and id4 please?
    LVL 9

    Accepted Solution

    Lets say the value value1_id4 is in a variable  caled variables.both_parts

    you could do this

          <cfset variables.first_part = ListGetAt(variables.both_parts, 1, "-")>
          <cfset variables.last_part= ListGetAt(variables.both_parts, 2, "-")>

    This could easily be a a query loop instead of variables.both_parts simply replace this with the variable retireved from the query.

    LVL 12

    Author Comment

    sounds what i was after many thanks

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    PRTG Network Monitor: Intuitive Network Monitoring

    Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

    A web service ( is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
    Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    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

    22 Experts available now in Live!

    Get 1:1 Help Now