FMX.Types3D.WideGetToken

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function WideGetToken(var Pos: Integer; const S: string; const Separators: string;
const Stop: string = ''): string;

C++

extern DELPHI_PACKAGE System::UnicodeString __fastcall WideGetToken(int &Pos, const System::UnicodeString S, const System::UnicodeString Separators, const System::UnicodeString Stop = System::UnicodeString());

Properties

Type Visibility Source Unit Parent
function public
FMX.Types3D.pas
FMX.Types3D.hpp
FMX.Types3D FMX.Types3D

Description

Gets a token from a string.

S is the string from where to get the token.

Pos is the position in S where the token starts. To get a token between two separators, search the first separator that appears in S using the Pos method, and start looking from there.

 Pos := Pos(separator, S);

If a separator is found at the Pos position in S, the separators are skipped, and the token starts at the next position after the last separator.

The Separators parameter specifies the separators that delineate 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.

GetToken returns the token. The returned token is a substring of S, which is delimited by the Pos and Separators parameters. The search stops when a separator specified by the Separators parameter appears or when the Stop string is found in S.

After the search finishes, Pos specifies the position in S that follows after the position of the separators that delimited the token.

If no token is found, it returns an empty string.

Example:

 var
   S, token: string;
   pos: integer;
 begin
   S := 'the -- token -- of string';
   pos := System.Pos('-', s);//pos=5;
   token := WideGetToken(pos, s, '-');
 end;

The result is:

token=' token '
pos=16'

See Also