|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
I'm having a big problem.
I'm pulling information from a AS400 server. In that server they have a file with a field named "Title" that when they populate that field they also added the year of publication of the book, and if the book was Trade or textbook, and also if the book comes with a CD or other extra "material", anyway...... This is the title that I pull from the as400 server "ADVANCED MACROMEDIA COLDFUSION 5 02 MACRO PB TRD OP" but I want it to just show "ADVANCED MACROMEDIA COLDFUSION 5" since all the titles have a two digits "year" I was wondering if anybody knew how to truncate or just show everything on the title that is on the left of the "year" in this case the 02... PLEASE I NEED HELP! |
|
#2
|
|||
|
|||
|
Look at the string functions, specifically left(), mid(), findNoCase(), etc.
If you always know that the string you want will end in "02" then you can just find that and then select everything to the left of it. But if you don't know what the actual values for the server name or the year will be this will be much more complicated. How can you know where the title of the book ends and the year and the other info begins?
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
|
#3
|
|||
|
|||
|
Quote:
Well that's the problem... sometimes it might end in 01, 97, 98 or 02, or 99 or any other year... that is the problem. |
|
#4
|
|||
|
|||
|
The best you can do is loop over the field and find the first element that is two numbers in a row (ie '97'), and then select everything to the left of that. Without some way to differentiate between the title and the year, that's your only option.
|
|
#5
|
|||
|
|||
|
Something like:
<cfset mystring = "ADVANCED MACROMEDIA COLDFUSION 5 02 MACRO PB TRD OP"> <cfoutput>#LEFT(mystring,REFind(" [0-9][0-9] ",mystring)-1)#</cfoutput>
__________________
** Don't expect me to code your needs, but if I am able to help, I'm willing. Shout, grab and use the hand! ** Man can no more own the land we walk upon, as they can lay claim on the air that we breath ** DeepDown I'm addicted to structures.... ohw and music ![]() ** Almost forgot I had an account here [*o*] |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > show just certain part of the string! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|