Results 1 to 4 of 4

Thread: Split Function <RESOLVED>

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Malaysia
    Posts
    345

    Split Function <RESOLVED>

    Hi!

    I am develeoping an application in asp.net with c# as the code behind.
    I want to extract the file name form a string say, "C\documents\abc\abc.doc".

    I have to get abc.doc in a variable.
    I wanted to use the Split function and get the last item of the array, which would have given me the file name.

    But, I am not been able to do so.

    My code is

    Code:
    string strDocumentName = System.Web.HttpContext.Current.Request.Files[0].FileName.ToString();
    string[]arrFile = strDocumentName.Split('\');
    
    //Loop through the array arrFile
    for(int i=0;i<=arrFile.GetUpperBound(0);i++)
    {
       strDocumentName = arrFile.GetValue(i).ToString();
    }
    Th problem is Split function gives an error with the delimeter (\). With every other delimiter it works fine.

    Pls help.
    Last edited by sinha; Aug 31st, 2005 at 03:46 PM.
    Thanks.

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