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 分割字符串 extractstrings

rightstr 返回字符串右边指定个数的新字符(串)

Delphi 之 tpagecontrol组件

Delphi listview导出到excel

Delphi 怎么不注册 dll 就调用 com

Delphi的窗体文件(dfm)文件中的汉字提取出来?

Delphi 删除指定字符串的所有实例

Delphi根据url获取缓存文件的方法

Delphi 根据开始和结束符取得中间字符串

Delphi 数字排序自动完成

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



打赏

取消

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

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

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

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

评论

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