Board index » delphi » Seperating out text from one field
alistairhayw...@hotmail.com (Alistair)
Delphi Developer |
Sat, 26 Nov 2005 08:14:39 GMT
Seperating out text from one field
I have a field in a database which is populated by three strings
seperated by a pipe (|) Lastname|firstname|Title I am trying to seperate them out to populate fields on my form, but Hayward|Alistair|mr gives me LastName: Hayward Moore|Sharon|ms gives me Lastname :Moore Brown|John|Mr gives me LastName: Brown Here's my code: 'EmailAddr' is where I store the three joined NameStr := fieldByName('EmailAddr').AsString; editLastName.Text := LeftStr(NameStr,pos('|',NameStr)-1); NameStr := RightStr(NameStr,Pos('|',NAmeStr)); editTitle.Text := NameStr; |