Forum > LCL

TStringList with objects

<< < (3/15) > >>

egsuh:
If you are looking for an object connected to a specific string, you may need following.


myobject := mylist.objects[MyList.IndexOf('Your specific string')];

SymbolicFrank:
I like TStringList, it's the object I use most, in general. It can do many useful things.

Yes, I could make a custom class for each implementation, that is probably a bit more efficient and to the point, but it takes more time and the result will be the same.

Thaddy:

--- Quote from: howardpc on February 21, 2022, 07:37:01 pm ---What class(es) would you suggest as an improvement on TStringList, and how are they better?

--- End quote ---
Any generic map or dictionary? Because they are type safe for all elements. But you know all that....

jcmontherock:
I found "AddObject", "InsertObject", but I didn't find "DeleteObject". Do you have any idea for deleting an object ? Maybe "Reduce" ?

Zvoni:

--- Quote from: jcmontherock on February 22, 2022, 11:32:41 am ---I found "AddObject", "InsertObject", but I didn't find "DeleteObject". Do you have any idea for deleting an object ? Maybe "Reduce" ?

--- End quote ---
???
Not tested.....

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---  MyList.Objects[SomeValidIndex].Free;  //FreeAndNil(MyList.Objects[SomeValidIndex]); 

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version