delphi 中文字符串截取


本文整理自网络,侵删。

 
procedure TForm1.Button1Click(Sender: TObject);
begin
 memo3.Lines.Add(   wShortFileName(edit1.Text,StrToInt(Edit2.Text)));
end;

function TForm1.wShortFileName(strFile: String; fnLen: Integer): String;
var
  Str: String;
  bWide: Boolean;
  wStr: WideString;
  i:integer;
  D_Result:string;
begin
  Result:=strFile;
  if Length(strFile)<=fnLen then Exit;
  Str:=strFile;
  wStr:=strFile;
 // bWide:=(Length(Str)<>Length(wStr));
 { while Length(Str)>(fnLen-2) do
  begin
    Delete(wStr,Length(wStr),1);
    Str:=wStr;
  end;}
     for i := 1 to fnLen do
     begin
       D_Result:=D_Result+ copy(wStr,i,1);
     end;
 Result:=D_Result ;
end;

相关阅读 >>

Delphi 简单播放mp3

Delphi打开网址链接的四种方法

Delphi wmi 获取网络信息

Delphi xe6 android拨号函数

Delphi 利用sendinput模拟鼠标键盘

Delphi操作文本文件简介

Delphi tzipfile 用法

Delphi formactivate与formshow事件有什么区别

Delphi webservices 字节数组 base64编码

Delphi 根据窗口类判断程序是否运行

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



打赏

取消

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

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

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

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

评论

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

    正在狠努力加载,请稍候...