Recent

Author Topic: SOLVED: TstringList breaks my String with '= '  (Read 722 times)

Jumbo

  • New Member
  • *
  • Posts: 29
SOLVED: TstringList breaks my String with '= '
« on: February 13, 2020, 05:38:21 pm »
I am a bit confused, and don't get the picture despite hour of search and try. It looks like the "=" is beeing used as a kind of deimmiter

I add this string to a TStringList :   Somthing=Anotherthing=and&this

Then I read the string back from th stringlist :  MyList.ValueFromIndex[MyList.Count-1]

Then the result of that is : Anotherthing=and&this

So where is the first part gone ?  : Somthing=

In other words, What is there so special to the "=" sign ?
« Last Edit: February 13, 2020, 06:14:32 pm by Jumbo »

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: TstringList breaks my String with '= '
« Reply #1 on: February 13, 2020, 06:03:47 pm »
TStringlist (well actually its ancestor TStrings) has several built-in features, including transparent processing of strings in the form
   name=value
and the array property ValueFromIndex[ ] returns only the value part of a name=value string.
You are looking for the array property Strings[ ]  which returns the full, unparsed string.
This is the default array property, so you can omit its name and access the string simply as MyList[index].
« Last Edit: February 13, 2020, 06:07:06 pm by howardpc »

Jumbo

  • New Member
  • *
  • Posts: 29
Re: TstringList breaks my String with '= '
« Reply #2 on: February 13, 2020, 06:13:43 pm »
howardpc: Thanks for the quick response... It's confirmed true ! Thanks.

My strings return perfectly as I put them!

TstringList is complicated ;)
« Last Edit: February 13, 2020, 06:15:24 pm by Jumbo »

 

TinyPortal © 2005-2018