Back

Pos:

Pos will return the index of the first character of a specified substring in a string.

Example:
This example came from Greg Liefs "MULTI-LINE COLUMN HEADINGS IN A STRINGGRID".

ptr := Pos(';', StringGrid1.Cells[Col, Row]) ;
   if ptr > 0 then begin
      Line1 := Copy(StringGrid1.Cells[Col, Row], 1, ptr - 1) ;
      Line2 := Copy(StringGrid1.Cells[Col, Row], ptr + 1,
                    Length(StringGrid1.Cells[Col,Row]) - ptr) ;


Back