Re: StringList cuts off first character....

Posted by John on December 28, 2005

In Reply to: StringList cuts off first character.... posted by GC0821 on December 19, 2005

: I'm using Delphi 7 and I've got a StringList that I'm loading values into. Showmessage(StringList.Text) will give the correct values:
: 'String'
: 'Example'
: 'Test'

: But (StringList.ValueFromIndex[index]) cuts off the first character in each string.

Normally, you access strings of a stringlist with StringList[index], for example: StringList[0] for the first string.

You used StringList.ValueFromIndex where you should not use it. Only if the stringlist contains "name-value pairs", you can use ValueFromIndex to access the "value part" of a string. In that case, the strings must be of the following format:

'name0=value0'
'name1=value1'
'fruit=apple'
'total=4'
...and so on...