zoukankan      html  css  js  c++  java
  • delphi IOUtils单元 处理文件路径相关

    Delphi 2010 新增功能:IOUtils单元:TPath的方法与属性
     
    以后路径相关的处理, 用 IOUtils.TPath 就很方便了.
    --------------------------------------------------------------------------------
     
    //较常用的方法:
    TPath.GetTempPath;                   {获取临时文件夹路径}
    TPath.GetTempFileName;               {获取一个临时文件名}
    TPath.GetPathRoot();                 {提取盘符, 如: c:}
    TPath.GetDirectoryName();            {提取路径}
    TPath.GetFileName();                 {提取文件名}
    TPath.GetExtension();                {提取扩展名}
    TPath.GetFileNameWithoutExtension(); {提取无扩展名的文件名}
    TPath.ChangeExtension();             {更换扩展名}
    TPath.DriveExists();                 {检查路径中的驱动器是否存在}
    TPath.GetFullPath();                 {根据相对路径给出全路径}
    TPath.HasExtension();                {判断是否有扩展名}
    TPath.IsPathRooted();                {判断是否是绝对路径}
    TPath.Combine();                     {结合路径}
    TPath.GetRandomFileName;             {产生一个随机文件名}
    TPath.GetGUIDFileName();             {用于产生一个唯一的文件名, 布尔参数决定名称中是否包含 -}
    TPath.IsValidPathChar();             {判断给定的字符是否能用于路径名}
    TPath.IsValidFileNameChar();         {判断给定的字符是否能用于文件名}
     
    //不常用的方法
    TPath.HasValidPathChars();
    TPath.HasValidFileNameChars();
    TPath.GetExtendedPrefix();
    TPath.IsExtendedPrefixed();
    TPath.IsUNCRooted();
    TPath.IsDriveRooted();
    TPath.IsUNCPath();
    TPath.MatchesPattern();
    TPath.GetInvalidFileNameChars;
    TPath.GetInvalidPathChars;
    TPath.GetAttributes();
    TPath.SetAttributes();
     
    //属性, 获取在不同平台下的各种路径分隔符, 都是只读的. 
    TPath.AltDirectorySeparatorChar;     {Windows 下是 ""}
    TPath.AltDirectorySeparatorChar;     {Windows 下是 "/"}
    TPath.ExtensionSeparatorChar;        {Windows 下是 "."}
    TPath.PathSeparator;                 {Windows 下是 ";"}
    TPath.VolumeSeparatorChar;           {Windows 下是 ":"}
     
  • 相关阅读:
    bzoj3295: [Cqoi2011]动态逆序对
    bzoj3262: 陌上花开
    bzoj1176: [Balkan2007]Mokia
    bzoj1935: [Shoi2007]Tree 园丁的烦恼
    [APIO / CTSC2007]数据备份 --- 贪心
    [APIO2007]风铃 --- 贪心
    [NOI2015]寿司晚宴 --- 状压DP
    [NOI2007]货币兑换 --- DP + 斜率优化(CDQ分治)
    [NOI2009]诗人小G --- DP + 决策单调性
    [HNOI2008]玩具装箱TOY --- DP + 斜率优化 / 决策单调性
  • 原文地址:https://www.cnblogs.com/yangxuming/p/6984427.html
Copyright © 2011-2022 走看看