Results 1 to 4 of 4

Thread: [RESOLVED] [3.0/LINQ] Manipulating strings

  1. #1

    Thread Starter
    Hyperactive Member Pac_741's Avatar
    Join Date
    Jun 2007
    Location
    Mexico
    Posts
    298

    Resolved [RESOLVED] [3.0/LINQ] Manipulating strings

    Hi, im trying to split this string but so far i cant get want i want this is the string : E:\Documents and Settings\Prox-YD\Escritorio\Music.mp3
    what i want to get is this
    from the string : Music

    but i dont know how to

    thanks
    C# and WPF developer
    My Website:
    http://singlebits.com/

  2. #2
    Fanatic Member
    Join Date
    Jun 2003
    Location
    Worcester, MA
    Posts
    782

    Re: [3.0/LINQ] Manipulating strings

    Split it into an array delimited by '\' then take the last element of the array. Once you have this do the substring from 0 to the location of '.'
    C#.net, VB, C++, Java, VS 2005/2008
    Dont' forget to rate posts that are helpful to you.

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [3.0/LINQ] Manipulating strings

    csharp Code:
    1. string fileName = System.IO.Path.GetFileNameWithoutExtension(@"E:\Documents and Settings\Prox-YD\Escritorio\Music.mp3");
    2.  
    3. MessageBox.Show(fileName);
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4

    Thread Starter
    Hyperactive Member Pac_741's Avatar
    Join Date
    Jun 2007
    Location
    Mexico
    Posts
    298

    Re: [3.0/LINQ] Manipulating strings

    thanks
    C# and WPF developer
    My Website:
    http://singlebits.com/

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