[Lazarus] Saving an array to a string

Philippe philippe at quarta.com.br
Tue Jul 1 17:12:05 CEST 2014


 

you can use


http://www.freepascal.org/docs-html/rtl/classes/tstringlist.html 

var
lStrings : TStringList; 

begin 

.... 

 lStrings :=
TStringList.Create;
 with lStrings do
 begin
 delimiter :=
yourdelimiter; // donĀ“t know if you can use "lineending"

strictdelimiter := true;
 DelimitedText := textfromyourfield;

 for n :=
0 to count - 1 do 

 myarray[ n] := strings[ n ]; 

 end; 


lStrings.free; 

Philippe 

Em 01.07.2014 12:04, Richard Mace escreveu:


> Thanks Michael. And reading it back? 
> On 1 Jul 2014 15:57,
"Michael Thompson" <mike.cornflake at gmail.com> wrote:
> 
>>> Is it
possible to save an array of string to a single string for storing in a
string field within a database?
>> 
>> Suspect it'll be something like

>> MyString := ''; 
>> For i := Low(MyArray) to High(MyArray) Do 
>>
MyString := MyString + MyArray[i] + LineEnding; 
>> 
>>
MyStringField.AsString := MyString; 
>> 
>> On 1 July 2014 16:49,
Richard Mace <richard.mace at gmail.com> wrote:
>> 
>>> Hi All,
>>> Is it
possible to save an array of string to a single string for storing in a
string field within a database? 
>>> If so, could anyone give me any
pointers please?
>>> 
>>> Thanks
>>> 
>>> Richard
>>> 
>>> --
>>>
_______________________________________________
>>> Lazarus mailing
list
>>> Lazarus at lists.lazarus.freepascal.org
>>>
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus [1]
>> 
>>
--
>> _______________________________________________
>> Lazarus mailing
list
>> Lazarus at lists.lazarus.freepascal.org
>>
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus [1]
> 
>
--
> _______________________________________________
> Lazarus mailing
list
> Lazarus at lists.lazarus.freepascal.org
>
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus [1]




Links:
------
[1]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20140701/b0f3ecda/attachment-0003.html>


More information about the Lazarus mailing list