Re: [fpc-pascal] Byte array manipulation

2009-08-17 Thread Wimpie Nortje
Andrew Brunner wrote: Hi there, I have a ByteArray unit that's pretty extensive. function toString(Var Item:TByteArray):string var iLen:Integer; begin iLen:=System.Length(Item); SetLength(Result,iLen); if iLen>0 then System.Move(Item[0],Result[1],iLen); end; Thanks, this will be a

Re: [fpc-pascal] Byte array manipulation

2009-08-16 Thread Andrew Brunner
Hi there, I have a ByteArray unit that's pretty extensive. function toString(Var Item:TByteArray):string var iLen:Integer; begin iLen:=System.Length(Item); SetLength(Result,iLen); if iLen>0 then System.Move(Item[0],Result[1],iLen); end; On Sun, Aug 16, 2009 at 12:35 PM, Wimpie Nortje

Re: [fpc-pascal] Byte array manipulation

2009-08-16 Thread Wimpie Nortje
theo wrote: AnsiString does not have problems with #0. Test: var aStr:AnsiString; begin aStr:='test-test-test'; aStr:=StringReplace(aStr,'-',#0,[rfReplaceAll]); //if you ouput now, you'll only see 'test'... aStr:=StringReplace(aStr,#0,'-',[rfReplaceAll]); //...but the text is still in the Strin

Re: [fpc-pascal] Byte array manipulation

2009-08-16 Thread theo
AnsiString does not have problems with #0. Test: var aStr:AnsiString; begin aStr:='test-test-test'; aStr:=StringReplace(aStr,'-',#0,[rfReplaceAll]); //if you ouput now, you'll only see 'test'... aStr:=StringReplace(aStr,#0,'-',[rfReplaceAll]); //...but the text is still in the String; Edit1.text

[fpc-pascal] Byte array manipulation

2009-08-16 Thread Wimpie Nortje
Hi all, I have a lot of byte arrays which contains mostly text but also #0. I am looking for functions to manipulate these arrays. The stuff in strutils are mainly what I need but they operate on strings which is not usable to me due to the #0. Are there any such functions in FPC? And whil