• Welcome to Forum.Deepsoftware.Com. Please login or sign up.
 

how to remove begin and end string????

Started by cptang, September 02, 2010, 05:42:48 am

Previous topic - Next topic

cptang

September 02, 2010, 05:42:48 am Last Edit: September 02, 2010, 05:51:43 am by cptang
packetBegin = "start" ;
packEnd      = "end";

send code is:
nrComm1->SendString("start" + Memo1->Text + "end");
receive code is:     
Memo2->Lines->Add(Packet->Data)  ;

ex:
send   "12345"
receive "start12345end"
but i think to receive "12345"

now,my method is
    Memo2->Lines->Add(Packet->Data.SubString(Packet->PacketBegin.Length()+1,Packet->DataLength - Packet->PacketBegin.Length() - Packet->PacketEnd.Length()))  ;

thx!

Roman Novgorodov

Hello

Yes you can extract useful part from data packet over SubString() method.
Please note that you can get length of header and end in following properties:
Packet->PacketBeginLength and Packet->PacketEndLength

Roman Novgorodov
DeepSoftware.com
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

cptang

Quote from: Roman Novgorodov on September 02, 2010, 08:56:57 am
Hello

Yes you can extract useful part from data packet over SubString() method.
Please note that you can get length of header and end in following properties:
Packet->PacketBeginLength and Packet->PacketEndLength

Roman Novgorodov
DeepSoftware.com


think u very much!
i use a nrDataProcessor1 component and add a datapacket
set begin and end is empty string,then it receive date is ok!