Delphi StrUtils-字符串函数RightStr、MidStr、LeftStr
引用单元:StrUtils
函数原型:
function RightStr
(Const Str: String; Size: Word): String;
begin
if Size > Length(Str) then Size := Length(Str) ;
RightStr := Copy(Str, Length(Str)-Size+1, Size)
end;
--------------------------------------
function MidStr
(Const Str: String; From, Size: Word): String;
begin
MidStr := Copy(Str, From, Size)
end;
--------------------------------------
function LeftStr
(Const Str: String; Size: Word): String;
begin
LeftStr := Copy(Str, 1, Size)
示例:
//假设字符串 sStr := ‘Delphi is the Good‘, 那么
LeftStr(sStr, 5); // ‘Delph‘
MidStr(sStr, 5, 8); // ‘hi is the‘
RightStr(sStr, 6); // ‘e Good‘
创建时间:2020.05.18 更新时间: