delphi ExtractClassName 字符串处理函数


本文整理自网络,侵删。

 
function ExtractClassName(const S: String): String;
var
  I, L, K1, K2: Integer;
begin
  L := Length(S);

  result := '';

  K1 := 0;
  K2 := 0;

  for I:= L downto 1 do
    if S[I] = '.' then
      if K2 = 0 then
        K2 := I
      else
      begin
        K1 := I;
        result := Copy(S, K1 + 1, K2 - K1 - 1);
        Exit;
      end;
  result := Copy(S, K1 + 1, K2 - K1 - 1);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
showmessage(ExtractClassName('www.delphitop.com'));     //结果 delphitop
end;

相关阅读 >>

Delphi 对zlib单元进行再封装

Delphi 中使用微软全文翻译的小例子

Delphi 字符串的分割

Delphi中使用汇编(关于pos函数的问题)

Delphi 让嵌入窗体的 webbrowser 控件无边框

Delphi 检测 iat hook api 的方法

Delphi 显示程序占用内存多少

Delphi捕获u盘插入或者拔出

Delphi分享pos函数。(比fastpos还要快)

Delphi 如何获取桌面图标方法

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



打赏

取消

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

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

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

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

评论

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