[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 173
  • Last Modified:

trimming strings

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

  • 2
1 Solution
pigmentartsAuthor Commented:
ie this value1_id4 to this value1 and id4 please?
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.

pigmentartsAuthor Commented:
sounds what i was after many thanks

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now