Results 1 to 4 of 4

Thread: Parsing expressions (any nice functions available?)

  1. #1

    Thread Starter
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051

    Parsing expressions (any nice functions available?)

    I'm making an MP3 file organiser.

    I want to be able parse various expressions relating to either rules, or naming methods for my files.

    An example of a rule might be the following:


    %FileName% = %IDTagArtist% - %IDTagTitle%

    A file that satisfies this rule could be the following:

    My Artist - Track Title.mp3

    with the IDTags for the artist and title set as "My Artist" and "Track Title" respectivly.

    In C++ i'd be able to do this very easily, using IOStreams, are there any functions in the .net framework that would help me in any way with this task (such as things like inserting variables into strings when a 'n%' or whatever is encountered)?

    Cheers for any replies.
    Last edited by SLH; May 23rd, 2005 at 02:36 PM.
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


  2. #2
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704

    Re: Parsing expressions (any nice functions available?)

    such as things like inserting variables into strings when a 'n%' or whatever is encountered
    well, there are a few ways to go about it - am I'm unsure how you are doing it - so here goes:

    String.Replace is one option:
    string fileName = string.Replace("%artistName%",artistName);

    String.Format is another option:
    string artistName = "Led Zepplin";
    string trackName = "Over the hills";

    string fileName = string.Format("{0} - {1}", artistName, trackName);

  3. #3

    Thread Starter
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051

    Re: Parsing expressions (any nice functions available?)

    That string.Format looks like what i want. Cheers.

    Don't suppose there's anything for doing the revserse?

    e.g. having a filename like:

    Led Zepplin - Over The Hills.mp3

    and getting the artist / title
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


  4. #4
    Frenzied Member <ABX's Avatar
    Join Date
    Jul 2002
    Location
    Canada eh...
    Posts
    1,622

    Re: Parsing expressions (any nice functions available?)

    I would think you would need to use Regular Expressions.
    Tips:
    • Google is your friend! Search before posting!
    • Name your thread appropriately... "I Need Help" doesn't cut it!
    • Always post your code!!!! We can't read your mind!!! (well, at least most of us!)
    • Allways Include the Name and Line of the Exception (if one is occuring!)
    • If it is relevant state the version of Visual Studio/.Net Framwork you are using (2002/2003/2005)


    If you think I was helpful, rate my post
    IRC Contact: Rizon/xous ChakraNET/xous Freenode/xous

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width