delphi 简单的删除字符串尾部数字的代码

时间:2021-03-25 21:14:52

delphi  简单的删除字符串尾部数字的代码

方式一:

function FilterShowName(const sName: String): String;
var
I: Integer;
begin
Result := sName;
if Result <> '' then
begin
for I := Length(Result) downto do
begin
if Result[I] in [''..'', '-'] then
Delete(Result, I, )
else
Break;
end;
end;
end;

方式二(未测试):

function GetChinese(S :string):string;
var
i,Temp :integer;
begin
Result := '';
i := ;
while i<Length(S) do
begin
if ord(S[i])<$A1 then
i := i +
else begin
Temp := ord(S[i]);
Temp := Temp shl ;
Temp := Temp + ord(S[i]);
if Temp>$B0A0 then
Result := Result + S[i]+S[i+];
i := i + ;
end;
end;
end;