FMX.Utils.GetToken
Delphi
function GetToken(var S: string; const Separators: string; const Stop: string = string.Empty): string;
function GetToken(var Pos: Integer; const S: string; const Separators: string; const Stop: string = string.Empty): string;
C++
extern DELPHI_PACKAGE System::UnicodeString __fastcall GetToken(System::UnicodeString &S, const System::UnicodeString Separators, const System::UnicodeString Stop = System::UnicodeString())/* overload */;
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | public | FMX.Utils.pas FMX.Utils.hpp |
FMX.Utils | FMX.Utils |
Description
Gets a token from a string.
GetToken returns the token and removes it from the initial string.
S
is the string from where to get the token.
Separators
specifies the separators that delineates the end of the token.
Stop
is a character that delineates the end of the search area of S
. By default, it is an empty string.
The returned token is a substring of S
, delimited at the end by a Separator
. The search stops when a Separator
appears or a Stop
character is found in S
.
If no token is found, it returns an empty string.
GetToken removes the leading or trailing blanks from the returned token and from the final form of S
.
Example:
var
S, token: AnsiString;
begin
S := 'token = string ;';
token := GetToken(S, '=', ';');
end;
The result is:
token='token' S='string ;'