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 字符串替换函数[单元文件 sysutils]

Delphi写的服务程序在服务管理器中显示“描述”

Delphi tfilestream流操作1

使用rad studio为安卓内置的java库

Delphi 一个call应该如何写?

Delphi xe 编译开关-一套代码不同平台编译

Delphi串口api函数

Delphi 检查ip地址合法性

Delphi线程中关闭程序

Delphi 长文件路径转换短文件路径

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



打赏

取消

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

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

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

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

评论

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