[Overview][Resource strings][Constants][Types][Procedures and functions][Index] Reference for unit 'strutils' (#rtl)

ExtractDelimited

Extract the N-th delimited part from a string.

Declaration

Source position: strutils.pp line 157

function ExtractDelimited(

  N: Integer;

  const S: String;

  const Delims: TSysCharSet

):String;

Arguments

N

  

Which word to extract

S

  

String to extract word from

Delims

  

Characters to use as word delimiters.

Function result

N-th word

Description

ExtractDelimited extracts the N-th part from the string S. The set of characters in Delims are used to mark part boundaries. When a delimiter is encountered, a new part is started and the old part is ended. Another way of stating this is that any (possibly empty) series of characters not in Delims, situated between 2 characters in Delims, it is considered as piece of a part. This means that if 2 delimiter characters appear next to each other, there is an empty part between it. If an N-th part cannot be found, an empty string is returned. However, unlike ExtractWord, an empty string is a valid return value, i.e. a part can be empty.

The pre-defined constant StdWordDelims can be used for the Delims argument. The pre-defined constant Brackets would be better suited the Delims argument e.g. in case factors in a mathematical expression are searched.

Errors

None.

See also

ExtractSubStr

  

Extract a word from a string, starting at a given position in the string.

ExtractWord

  

Extract the N-th word out of a string.

ExtractWordPos

  

Extract a word from a string, and return the position where it was located in the string.

The latest version of this document can be found at lazarus-ccr.sourceforge.net.