Delphi 处理链接和文件路径结尾\和/


本文整理自网络,侵删。

 
function TrimSlashes(s: string; all: Boolean = False): string;
begin
  while (s <> '') and CharInSet(s[1], ['/', '\']) do
    Delete(s, 1, 1);
  if all then
    while (s <> '') and CharInSet(s[length(s)], ['/', '\']) do
      Delete(s, length(s), 1)
  else
    while (s <> '') and (s[length(s)] = '\') do
      Delete(s, length(s), 1);
  Result := s;
end;

如:c:\123\  结果 c:\123
如:http://www.baidu.com/  结果 http://www.baidu.com

相关阅读 >>

Delphi 写3389自动登录器

Delphi 复制文件到剪贴板

Delphi 通过机器名读取ip地址的代码

Delphi pagecontrol不�@示tab方式

快速查询posex与posrightex

Delphi 实现dns上线域名解析(用于远控server)

Delphi tthread中文注释

Delphi webbrowser1 保存文档为 .html

Delphi d10.x 在android 9及更高版本下使用Delphi获取设备序列号?

Delphi制作外挂的操作技巧

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...