RightPart function
String / Filename routines |
![]() ![]() ![]() |
acUtils
|
function RightPart(const SubStr, Str: String): String;
|
The LeftPart function finds the first occurence of any sub-string (SubStr parameter) in specified string (Str parameter) and returns the part of string (SubStr) AFTER the separator (Str). If the SubStr can not be found in the Str, the function returns empty string.
|
|
![]() |
// For example, we need to get the REALM NAME (between doublequotes)
|
RealmName := 'Basic realm="REALM NAME"';
|
|
// let's try...
|
RealmName := RightPart('="', RealmName); // result: REALM NAME"
|
// and get rid from next doublequote
|
RealmName := LeftPart('"', RealmName); // result: REALM NAME
|
function RightPart(const SubStr, Str: String): String;
|
var
|
I: Integer;
|
begin
|
I := Pos(SubStr, Str);
|
if I <> 0 then
|
Result := Copy(Str, I + Length(SubStr), Length(Str))
|
else
|
Result := '';
|
end;
|
LeftPart, RightPart, LeftPartR, RightPartR, PosR and SplitStr routines.
|