- SEO目前最重要的三点
- sql server错误21776:[SQL-DMO]名称"dbo"在Users集合中
- 淘宝点击量和访客数有什么用?
- 老站长交你如何做好网站内容的维护
- 判断是否为数字
- 矩阵号是什么
- PHP substr()函数的用法详解
- nofollow属性的介绍和使用1
- seo-Url优化
- 伪静态下不能使用FCKeditor的解决方案ok
邮箱:
手机:15383239821
Path.GetExtension 方法
返回指定的路径字符串的扩展名。
要注意的是:扩展名并不包含"."
命名空间:System.IO
path 从其获取扩展名的路径字符串。
返回值
包含指定路径的扩展名(包括“.”)的 String、空引用(在 Visual Basic 中为 Nothing) 或 Empty。如果 path 为 空引用(在 Visual Basic 中为 Nothing),则 GetExtension 返回 空引用(在 Visual Basic 中为 Nothing)。如果 path 不具有扩展名信息,则 GetExtension 返回 Empty。
public static string GetExtension (
string path
)
通过搜索 path 来查找句点 (.)、以路径中的最后一个字符为起始并继续直到路径的开始,获取 path 的扩展名。
string fileName = @"C:\mydir.old\myfile.ext";
string path = @"C:\mydir.old\";
string extension;
extension = Path.GetExtension(fileName);
Console.WriteLine("GetExtension('{0}') returns '{1}'",
fileName, extension);
extension = Path.GetExtension(path);
Console.WriteLine("GetExtension('{0}') returns '{1}'",
path, extension);
// This code produces output similar to the following:
//
// GetExtension('C:\mydir.old\myfile.ext') returns '.ext'
// GetExtension('C:\mydir.old\') returns ''
-
2020-11-23C#中去掉字符串的最后一个字符
-
2023-09-21PHP 头部defined('IN_SYS')) 有什么作用?
-
2025-12-09[MaxLength]中使用ErrorMessage属性
-
2023-10-22.net 工厂方法模式 c# 什么是工厂模式
-
2010-07-20网站如何通过有效的内部链接获得更高的权重
-
2026-01-31ElementPlus布局容器
