Link to home
Start Free TrialLog in
Avatar of T0masz
T0masz

asked on

data processing split string by another string

Im reading the output from a serial port, it has an event whenever a new line is reached
so the output is buffored per line. the output looks something like

----- somedata some data
     some data
     some data
     some data
------ new data  new
     new  new
     new
     new
     new
    ldkslsdjf

the sequence starts with -------, now I want to have a buffor where I oneventdata
it would add to the string I have the new data then phrase it looking for ------ the new sequence if there is one then the the thing would get processed. Now I tried looking for a split function that would allow the delimeter to be another string but couldnt find one. Can anyone help me?

Tom
Avatar of LRHGuy
LRHGuy

Try something like:

I:=pos('-- ',inputdata);
if I>0 then begin
  leftside:=copy(inputdata,1,I+2);
  rightside:=copy(inputdata,I+3,255);  // everything after the "-- "
end;
ASKER CERTIFIED SOLUTION
Avatar of kretzschmar
kretzschmar
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
any results?
Avatar of T0masz

ASKER

Sorry, I took some time off :)

It works :)
Thanks
Tom