RightStr Function
Returns the substring consisting of the last N characters of S.

Unit
QESBPCSConvert

Declaration
Function RightStr(const S: string; const N: LongWord): string;

Description
Also See: LeftStr, RightAfterStr

Parameters
the String from which the right substring is to be taken.
the length of the resultant substring. If Length (S) < N then S is returned.

Category
Extra String Handling Routines

Implementation

function RightStr (const S: string; const N: LongWord): string;
var
     M: LongWord;
begin
     M := Int64 (Length (S)) - N + 1; // Calculate the starting point
     if M < 1 then // If longer then string, return string
          M := 1;
     Result := Copy (S, M, N); // Return last N characters
End;


HTML generated by Time2HELP
http://www.time2help.com