help files
Z505 | PasWiki | FUQ | Search | Main Docs | API Guide



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

ExtractWord

Extract the N-th word out of a string.

Declaration

Source position: strutils.pp line 152

function ExtractWord(

  N: Integer;

  const S: String;

  const WordDelims: TSysCharSet

):String;

Arguments

N

  

Which word to extract.

S

  

String to extract the word from.

WordDelims

  

Characters to use as word delimiters

Function result

The N-th word, or empty if N is out of range.

Description

ExtractWord extracts the N-th word from the string S. The set of characters in WordDelims are used to mark word boundaries. A word is defined as any non-empty sequence of characters which are not present in WordDelims: if a character is not in WordDelims, it is considered as part of a word. If an N-th word cannot be found, an empty string is returned.

Unlike ExtractDelimited, an empty string is not a valid return value, i.e. is not a word. If an empty string is returned, the index N was out of range.

The pre-defined constant StdWordDelims can be used for the WordDelims argument.

Errors

None.

See also

ExtractWordPos

  

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

ExtractSubStr

  

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

ExtractDelimited

  

Extract the N-th delimited part from a string.

IsWordPresent

  

Check for the presence of a word in a string.

WordCount

  

Count the number of words in a string.

WordPosition

  

Search position of Nth word in a string.

Notes

 No notes exist for this page yet. 





lufdoc, Powtils, fpc, freepascal, delphi, kylix, c/c++, mysql, cgi web framework docs, Z505