Recent

Author Topic: TStringlist modification suggestion  (Read 1390 times)

jack616

  • Sr. Member
  • ****
  • Posts: 266
TStringlist modification suggestion
« on: October 04, 2015, 01:09:10 pm »
When using Tstringlist with name=value pairs any string added using  "myList.add(data);" will generate an
error if 'data' contains an '=' character and it is used later - for example if the value data is a string representation
of an integer which is used as an integer elsewhere. (strToInt will then bug out as Tstringlist sees the first "=" as the seperator)

I have tried to change the default character but I can't get it to work - probably my fault but that would not
be the best approach in my situation at present anyway.

What I would like to suggest is that TStringlist trap the character and return a specified result code.
TStringlist does this for limited situations but not this one - the documentation says the results are undefined
for other situations

If this happened a string could be modified on the fly to enable it to be added without having to scan an entire
data list "just in case"

Another "fix" for this could be to have the seperator test be a rightStr rather than leftStr? ie The last occurrence rather than the first.

I hope that makes sense -

jack

 
« Last Edit: October 04, 2015, 01:15:24 pm by jack616 »