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

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:
  #1  
Old August 11th, 2005, 09:46 AM
StuL StuL is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 9 StuL User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 39 m 4 sec
Reputation Power: 0
Parsing string

Hi all

I am a relative novice to Delphi programming and I have come unstuck!

I am trying to create a program that will allow me to take a string (an MP3 filename), specify the format it is written in and take the parts of the filename and store them in the ID3 tag of the file.

For example, the filename may be as follows:

Oasis - Don't Believe the truth - 1 - Turn up the sun

And the format would (for my program)

%artist - %album - %trackNo - %title

What I would like to do is to then take the seperate sections of the filename and store them in the ID3 tag. Saving the ID3 information is not the problem, separating the string is. I could quite easily parse the filename string if I knew the format which it was to come in but that is the problem, I don't know.

Could anyone be so kind as to offer some advice as to how I might go about this?

Kind regards
Stu

Reply With Quote
  #2  
Old August 21st, 2005, 02:12 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Click here for more information.
 
Join Date: Nov 2001
Location: Glendale, Los Angeles County, California, USA
Posts: 7,713 Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 3 Days 11 h 21 m 11 sec
Reputation Power: 1179
You could use Pos() to find the position of '-' in the string and then use Copy() to copy a substring out of a string:
Code:
	sStr := 'Oasis - Don''t Believe the truth - 1 - Turn up the sun';
	nPos := Pos('-', sStr);
	sName := Copy(sStr, 1, nPos - 1);
	// Get next part
	sStr := Copy(sStr, nPos + 1, 99999);
	nPos := Pos('-', sStr);
	sAlbum := Copy(sStr, 1, nPos - 1);
	// Rinse and repeat
__________________
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne

Puzzle of the Month solved by Keath and KevinADC, superior perl programmers of the month

Reply With Quote
  #3  
Old August 29th, 2005, 04:10 PM
StuL StuL is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 9 StuL User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 39 m 4 sec
Reputation Power: 0
Thank you for your post Scorpions4ever, it looks very ınteresting and could be just want I want/need. I'm currently on holiday at the minute but I wıll have a play with your suggestion when I return.

Thanks very much and I will keep you posted!

PS Apologies for any weird characters which may randomly appear. I'm a touch typist who doesn't very well adjust to another keyboard layout (Turkish in this case!).

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreDelphi Programming > Parsing 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 2 hosted by Hostway
Stay green...Green IT