自己解決了﹐只是不是最有效率的。function RightPos(SubStr,S: String): Integer; var i,j,iCount: Integer; begin iCount := 0; for i := 0 to 100 do begin j := Pos(SubStr,S); if j > 0 then begin iCount := iCount + j; S := Copy(S,j + 1,Length(S) - j); end else break; end; Result := iCount; end;
Returns the reverse of a specified string.UnitStrUtilsCategorystring handling routinesDelphi syntax:function ReverseString(const AText: string): string;C++ syntax:extern PACKAGE AnsiString __fastcall ReverseString(const AnsiString AText);DescriptionReverseString returns the string specified by AText with the characters in reverse order.
var
i,j,iCount: Integer;
begin
iCount := 0;
for i := 0 to 100 do
begin
j := Pos(SubStr,S);
if j > 0 then
begin
iCount := iCount + j;
S := Copy(S,j + 1,Length(S) - j);
end
else
break;
end;
Result := iCount;
end;
Length(Str) downto Length(Str) -Length(SubStr)
判断