Questions tagged [tstringlist]

TStringList is a RTL class whose purpose is to store and manipulate a list of strings. It is defined in Classes.pas

163 questions
5
votes
4 answers

Faster way to split text in Delphi TStringList

I have an app that needs to do heavy text manipulation in a TStringList. Basically i need to split text by a delimiter ; for instance, if i have a singe line with 1000 chars and this delimiter occurs 3 times in this line, then i need to split it in…
delphirules
  • 5,259
  • 13
  • 43
  • 87
5
votes
1 answer

TStringList behavior with non ANSI files

In my application, when I want import a file, i use TStringList. But, when someone export data from Excel, the file encoding is UCS-2 Little Endian, and TStringList can't read the data. There is any way to validate this situation, identify the text…
EProgrammerNotFound
  • 2,333
  • 4
  • 21
  • 54
4
votes
1 answer

Handling very large text files using TStreamReader and TStringList

I am using Embarcadero's Rad Studio Delphi (10.2.3) and have encountered a memory issue while reading in very large text files (7 million lines+, every line is different, lines can be 1 to ~200 characters in length, etc.). I am fairly new at Delphi…
4
votes
3 answers

Delphi - Read File To StringList, then delete and write back to file

I'm currently working on a program to generate the hashes of files, in Delphi 2010. As part of this I have a option to create User Presets, e.g. pre-defined choice of hashing algo's which the user can create/save/delete. I have the create and load…
Flatlyn
  • 1,890
  • 5
  • 39
  • 65
4
votes
1 answer

unique_ptr dsts(new TStringList[5]) fail

MyEnvironment: C++ Builder XE4 I am trying to use array of TStringList using unique_ptr<>. Following didn't give any error: unique_ptr vals(new int [10]); On the other hand, following shows error: unique_ptr sls(new…
sevenOfNine
  • 1,399
  • 14
  • 33
4
votes
1 answer

Delphi XE7 Android how to store function pointers to later access?

When using Delphi to create Windows applications, it is possible do store function pointers in a TStringList variable, something like... function n_func(var data: integer): integer; begin //do something with data that will change its value …
André Murta
  • 131
  • 1
  • 8
4
votes
1 answer

Inno Setup create TStringList from CDATA

I have a list in a CDATA element. How do I get the elements from the CDATA and add this to TStringList? If I get the CDATA string, it returns: 'string'#10#9#9#9'string'#10#9#9#9'string'#10#9#9#9'string'... However the characters #10#9#9#9 are not…
MarkOccam
  • 97
  • 6
4
votes
1 answer

How do I store and load a list of key-value pairs in a string?

I have a list of strings and the values they are to be replaced with. I'm trying to combine them in a list like 'O'='0',' .'='.', ... so it's easy for me to edit it and add more pairs of replacements to make. Right now the best way I could think of…
S F
  • 71
  • 1
  • 2
  • 7
4
votes
3 answers

Replacement for TStringList in Delphi Prism.

I am migrating an application written in Delphi 2007 .Net to Delphi Prism, which is the best option to replace the TStringList and TStrings class? Thanks in advance. Bye.
Salvador
  • 15,053
  • 31
  • 128
  • 232
4
votes
3 answers

Wrapping TStringList in a Record

I tend to use Delphi's TStringList for text manipulation, so I write a lot of procedures/functions like: var TempList: TStringList; begin TempList:= TStringList.Create; try // blah blah blah do stuff with TempList finally …
HMcG
  • 2,003
  • 3
  • 21
  • 36
4
votes
2 answers

TStringList and TThread that does not free all of its memory

Version used: Delphi 7. I'm working on a program that does a simple for loop on a Virtual ListView. The data is stored in the following record: type TList=record Item:Integer; SubItem1:String; SubItem2:String; end; Item is the index. SubItem1…
Pascal Bergeron
  • 573
  • 2
  • 8
  • 22
3
votes
2 answers

Delphi: Types other than Integer for indexing TStringList items

Arrays can be indexed using user-defined enumerated types. For example: type TIndexValue = (ZERO = 0, ONE, TWO, THREE, FOUR); var MyArray: array[Low(TIndexValue) .. High(TIndexValue)] of String; Elements from this array can then be referenced…
ardnew
  • 1,780
  • 16
  • 26
3
votes
1 answer

How Can I Replace StringList.Sort with a Stable Sort in Delphi?

I'm doing a simple StringList.sort, but Delphi uses a QuickSort that is not a stable sort, meaning it may change the relative order of records with equal keys. I need to use a stable sort. What would be the easiest way for me to implement this?…
lkessler
  • 19,414
  • 31
  • 125
  • 196
3
votes
2 answers

How to identify Delphi StringList object is created or not

I have declared variable of TStringList in private section. In a button click event I want to access that TStringList object. sVariable:= TStringList.Create; sVariable.add('Test1'); Now whenever i click on that button each time its newly created…
Nalu
  • 1,097
  • 4
  • 19
  • 42
3
votes
4 answers

Delphi Stringlist in Record

Is it possible to have a stringlist in a record? EG TImportStats = record ATotal:Integer; BTotal:String; AList:TStringist; end; and if I presume I would need to create it before using the record?
colin
  • 2,793
  • 6
  • 37
  • 48
1 2
3
10 11