I have a TStringList that is loaded with a few thousand Name-Value Pairs.
One of them is
004001000002000=Timbre2 Volume 0~127 4995
I find a specific index by calling IndexOfName with the string '004001000002000'. I expect ValueFromIndex to return the string 'Timbre2 Volume 0~127 4995'
Instead, when I access this value using the ValueFromIndex, it returns the string:
~127 4995
What causes this? Is Tilde a special character that causes the string to be truncated? Can I set it to something else?
I can't reproduce the problem using the following code in a TButton.OnClick
event (Delphi 2007 and Delphi 7 - screen capture from Delphi 2007 test):
procedure TForm2.Button2Click(Sender: TObject);
var
SL: TStringList;
i: Integer;
begin
SL := TStringList.Create;
try
SL.Add('004001000002000=Timbre2 Volume 0~127 4995');
SL.Add('ABCDEF=Testing 1 2 3');
i := SL.IndexOfName('004001000002000');
if i > -1 then
ShowMessage(SL.ValueFromIndex[i])
else
ShowMessage('IndexOfName returned -1');
finally
SL.Free;
end;
end;
This correctly shows the expected dialog:
I also tested using the simpler method:
ShowMessage(SL.Values['004001000002000']);
This displayed the identical ShowMessage
dialog.