Solved

string breakup options

Posted on 2013-06-20
4
232 Views
Last Modified: 2013-06-21
I have a following string

 INCISE SPINE 3 COLUMN ADL SEGücertified~12/12/2012

ücertified - This thing can be like ücertified, ünoncertified, üpending

so i am trying to remove all characters from right starting from ü

2. Another way i tried using listfirst, tried using a function inside the query like

<cfquery name="GetTitles" DATASOURCE="#dsn#">
  SELECT ArticleID,Title,{fn ListFirst(mystring,'ü')} as mystring
  FROM News
  ORDER BY DatePosted
</cfquery>


also, what if i need to separate this string into 3 different variables, 1 - string , 2 - the status [certified,noncertified, date], 3- date
0
Comment
  • 2
  • 2
4 Comments
 
LVL 52

Accepted Solution

by:
_agx_ earned 500 total points
ID: 39263689
Use list functions with multiple delimiters:  "ü" and "~"

     <cfset delims = "ü~">
     <cfset theString = getToken( yourString, 1, delims)>
     <cfset theStatus = getToken( yourString, 2, delims)>
     <cfset theDate = getToken( yourString, 3, delims)>
0
 
LVL 16

Author Comment

by:Gurpreet Singh Randhawa
ID: 39263714
oh, Thanks agx,

how i forgot the GetToken

i will try and get back asap
0
 
LVL 16

Author Comment

by:Gurpreet Singh Randhawa
ID: 39263715
but what if i need to remove those values starting from ü~ onwards
0
 
LVL 52

Expert Comment

by:_agx_
ID: 39263729
Split it on the "ü" and grab the first part.  But that's what the code above does.  The results would be:

theString = INCISE SPINE 3 COLUMN ADL SEG    <=== everything before the ü
theStatus = certified
theDate = 12/12/2012
0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi, I will be creating today a basic tutorial on how we can create a Mail Custom Function and use it where ever we want. The main advantage about creating a custom function is that we can accommodate a range of arguments to pass to the Function and …
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 …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

856 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