ExtractWordPos ? lazarus / 61-Beginners ---------------------------------------------------------------------- JLWest · 2019-03-20 00:50 function ExtractWordPos( N: Integer;                                      const S: string;                                     const WordDelims: TSysCharSet;                                    var Pos: Integer) : string; I think I would like to use this function but not sure how to call it. Var  Answer : String;  aPos      : Integer;  Item      : String = 'Now is the time for all good men'; begin Answer := ExtractWordPos(4,Item,['  '] , aPos); And wouldb't it return 4 because I specifying 4 in  "N: Integer"; It's obvious that I'm not reading this right; ---------------------------------------------------------------------- lucamar · 2019-03-20 01:11 The function returns the Nth word as result and the character position in which it was found in Pos With your example it should return "time" and "aPos = 12". Does it return something else? ---------------------------------------------------------------------- BobDog · 2019-03-20 01:51 According to the help file . . . function ExtractWordPos(   N: Integer;   const S: string;   const WordDelims: TSysCharSet;   out Pos: Integer ):string; N   Which word to extract S    String to extract a word from. WordDelims  Characters to use as word delimiters Pos    On return, contains the position of the N-th word. . . . But if I make the deliminator more than one character I get an error. So, just one space as deliminator. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i     program pos;uses strutils;  Var Answer : String; aPos      : Integer; Item    : String = 'Now is the time for all good men'; beginAnswer := ExtractWordPos(4,Item,[' '] , aPos);writeln(answer,'  ',apos);writeln('Press return to end . . .'); readln;end. result time  12 Press return to end . . . ---------------------------------------------------------------------- lucamar · 2019-03-20 03:10 Quote from: BobDog on March 20, 2019, 02:51:13 amBut if I make the deliminator more than one character I get an error. So, just one space as deliminator. WordDelims is a TSysCharSet, i.e. a set of AnsiChar; which means you can use, say: Code: [Select]FoundWord := ExtractWordPos(N, SrcStr, [' ', ',', '.', ':', ';'], APos);but, of course, not something like: Code: [Select]FoundWord := ExtractWordPos(N, SrcStr, [':::', '=='], APos); ---------------------------------------------------------------------- JLWest · 2019-03-20 03:38 Thank you;