ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old August 10th, 2004, 01:14 PM
cfgirl cfgirl is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 14 cfgirl User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Exclamation show just certain part of the string!

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!

Reply With Quote
  #2  
Old August 10th, 2004, 01:23 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,627 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 10 h 8 m 55 sec
Reputation Power: 53
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

Reply With Quote
  #3  
Old August 10th, 2004, 02:06 PM
cfgirl cfgirl is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 14 cfgirl User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
Originally Posted by kiteless
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?



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.

Reply With Quote
  #4  
Old August 10th, 2004, 07:15 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,627 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 10 h 8 m 55 sec
Reputation Power: 53
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.

Reply With Quote
  #5  
Old August 11th, 2004, 05:20 AM
DeepDown DeepDown is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Netherlands
Posts: 99 DeepDown User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 1 m 8 sec
Reputation Power: 6
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*]

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > show just certain part of the string!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway