RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
DB.ExtractFieldName Function

Returns the next name in a semicolon-delimited string of field names.

Pascal
function ExtractFieldName(const Fields: string; var Pos: Integer): string; overload;
C++
AnsiString ExtractFieldName(const AnsiString Fields, int Pos);

Use ExtractFieldName when parsing a semicolon-delimited string of names such as those used as parameters to many methods on database-specific objects. 

Fields is a semicolon-delimited string of names. 

Pos is the starting position of the next string in Fields. On exit from the function, Pos is updated to the starting position of the following string. If there is no following string, on exit, Pos is one more than the length of Fields. 

ExtractFieldName returns a string with the single name that began at position Pos when the function was called. 

ExtractFieldName is typically used in a loop, as follows: 

Pos := 1;  

while Pos <= Length(FieldNames) do
begin
  Name := ExtractFieldName(FieldNames, Pos);
  // do something with Name
end;

int Pos = 1;

while (Pos <= FieldNames.Length())
{
  AnsiString Name = ExtractFieldName(FieldNames, Pos);
  // do something with Name
}

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!