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



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

WordPosition

Search position of Nth word in a string.

Declaration

Source position: strutils.pp line 151

function WordPosition(

  const N: Integer;

  const S: String;

  const WordDelims: TSysCharSet

):Integer;

Arguments

N

  

Which word to search for

S

  

String to search in.

WordDelims

  

Characters to be used as word delimiters.

Function result

Position of the N-th word, or -1 if there is none.

Description

WordPosition returns the position (in characters) of the N-th word in the string S. A word is a non-empty string of characters bounded by one of the characters in WordDelims. If N is out of range, zero is returned.

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

Errors

None

See also

WordCount

  

Count the number of words in a string.

StdWordDelims

  

Standard word delimiter values.

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.

Notes

 No notes exist for this page yet. 





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