"Go" C # some operations on a path

Source: Internet
Author: User

String filePath = @ "E:\Randy0528\ Chinese catalog \justtest.rar";

Response.Write ("File path:" +filepath);

Response.Write ("<br/> Change the extension of the path string. <br/> ");

Response.Write (System.IO.Path.ChangeExtension (FilePath, "txt"));

Response.Write ("<br/> returns directory information for the specified path string: <br/> ");

Response.Write (System.IO.Path.GetDirectoryName (FilePath));

Response.Write ("<br/> returns the extension of the specified path string. <br/> ");

Response.Write (System.IO.Path.GetExtension (FilePath));

Response.Write ("<br/> returns the file name and extension of the specified path string. <br/> ");

Response.Write (System.IO.Path.GetFileName (FilePath));

Response.Write ("<br/> returns the file name of the specified path string that does not have an extension.) <br/> ");

Response.Write (System.IO.Path.GetFileNameWithoutExtension (FilePath));

Response.Write ("<br/> Gets the root directory information for the specified path. <br/> ");

Response.Write (System.IO.Path.GetPathRoot (FilePath));

Response.Write ("<br/> returns a random folder name or a file name.) <br/> ");

Response.Write (System.IO.Path.GetRandomFileName ());

Response.Write ("<br/> creates a uniquely named 0-byte temporary file on disk and returns the full path of the file. <br/> ");

Response.Write (System.IO.Path.GetTempFileName ());

Response.Write ("<br/> returns the path of the current system's Temp folder. <br/> ");

Response.Write (System.IO.Path.GetTempPath ());

Response.Write ("<br/> determines whether the path includes a file name extension.) <br/> ");

Response.Write (System.IO.Path.HasExtension (FilePath));

Response.Write ("<br/> gets a value that indicates whether the specified path string contains absolute path information or contains relative path information.) <br/> ");

Response.Write (System.IO.Path.IsPathRooted (FilePath));

File path: E:\Randy0528\ Chinese directory \justtest.rar
Change the extension of the path string.
E:\Randy0528\ Chinese Catalogue \justtest.txt
Returns directory information for the specified path string:
E:\Randy0528\ Chinese Catalog
Returns the extension of the specified path string.
. rar
Returns the file name and extension of the specified path string.
Justtest.rar
Returns the file name of the specified path string that does not have a name extension.
Justtest
Gets the root directory information for the specified path.
E:\
Returns the random folder name or file name.
Ct2h5b2h.sed
Creates a uniquely named 0-byte temporary file on the disk and returns the full path of the file.
C:\Documents and Settings\randy\local settings\temp\tmpad.tmp
Returns the path to the temporary folder for the current system.
C:\Documents and Settings\randy\local Settings\temp\
Determines whether the path includes a file name extension.
True
Gets a value that indicates whether the specified path string contains absolute path information or contains relative path information.
True

"Go" C # some operations on a path

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.