Re: Using only part of a string


[ Post Followup ] [ Delphi Forum -- by DelphiLand ]

Posted by WAllison on January 03, 2004 at 21:14:12:

In Reply to: Using only part of a string posted by Joey on January 02, 2004 at 17:01:07:

: I have a problem when using my TListBox component it is..

: When i add an item i have made it so that it adds it puts The item number next to the text example..

: Say it adds 'Hello' in position 20 it will add '20. Hello' but later i need to remove this number how would i go about removing the width of Index + . + ' '?? plz help

: thx :)

try something like:

Delete(ListBox1.Items[0].Caption
, 1, Pos('. ', ListBox1.Items[0].Caption
));

Delete(string, index, count) - deletes a substring within a string(note the first index is 1 (if u use 0 - it deletes nothing)

Pos(Substring, string) - returns the index of a substring within a string



Related Articles and Replies:


[ Post Followup ] [ Delphi Forum ]
[ DelphiLand: free Delphi source code, tips, tutorials ]