0

I have a text file thats about 53,000 lines. I wanted to put each line into a stringlist. for example I have:

2023/01/30,23:22:25, 0. 7. 5,SP60-1,03,Wait for post process,130000,Start at Wait for post process
2023/01/30,23:22:25, 0. 7. 5,SP60-1,04,Product 1board end,000000,Product 1board end
2023/01/30,23:22:14, 0. 7. 5,SP60-1,06,PCB carrying in,000000,PCB carrying in
2023/01/30,23:21:46, 0. 7. 5,SP60-1,06,PCB carrying in,000000,PCB carrying in
2023/01/30,23:21:46, 0. 7. 5,SP60-1,03,Wait for pre process,120001,Exit Wait for pre process
2023/01/30,23:21:28, 0. 7. 5,SP60-1,03,Wait for pre process,120000,Start at Wait for pre process
2023/01/30,23:21:28, 0. 7. 5,SP60-1,04,Product 1board end,000000,Product 1board end
2023/01/30,23:21:18, 0. 7.70,CM212-A1,03,Wait for post process,130000,Start at Wait for post process Stage No1, (Whole MC), (Single Lane), PCB ID:                
2023/01/30,23:21:17, 0. 7.70,CM212-A1,04,Product 1board end,000000,Product 1board end Stage No1, (Single Lane), Present PCB Position:No1 mount position (conveyor), PCB ID:+044363D897206C+
2023/01/30,23:21:07, 0. 7.70,CM212-A1,03,Wait for post process,130000,Start at Wait for post process Stage No2, (Whole MC), (Single Lane), PCB ID:                
2023/01/30,23:21:07, 0. 7.70,CM212-A1,28,Board available,000000,Board available Stage No2, (Single Lane), PCB ID:                , BAON
2023/01/30,23:21:07, 0. 7.70,CM212-A1,04,Product 1board end,000000,Product 1board end Stage No2, (Single Lane), Present PCB Position:No1 mount position (conveyor), PCB ID:+044363D896DB6A+
2023/01/30,23:21:06, 0. 7. 5,SP60-1,06,PCB carrying in,000000,PCB carrying in
2023/01/30,23:21:06, 0. 7. 5,SP60-1,03,Wait for pre process,120001,Exit Wait for pre process
2023/01/30,23:21:04, 0. 7. 5,SP60-1,07,PCB carrying out,000000,PCB carrying out
2023/01/30,23:21:04, 0. 7. 5,SP60-1,03,Wait for pre process,120000,Start at Wait for pre process
2023/01/30,23:21:04, 0. 7. 5,SP60-1,04,Product 1board end,000000,Product 1board end

I am not sure how to define the "line", I would think there is a way for the stringlist to import the text file (actually its a .out file but its just text)

What is the best way to do this considering there is about 53k lines?
thanks

5
  • 2
    Have you tried simply calling the TStringList's LoadFromFile() method yet? It knows how to load a line-oriented text file, where each line becomes a separate string entry. Jan 31 at 17:45
  • you are right, some reason I was thinking it would use the comma for each line. @rem
    – user41758
    Jan 31 at 17:53
  • Do you want to split the content of each line into a stringlist? Jan 31 at 18:12
  • @DelphiCoder that is next, but having trouble with commatext, it seems to break at comma and spaces. but i guess thats another question
    – user41758
    Jan 31 at 19:57
  • Yes, new question, please. But for this you should find several examples here in SO or elsewhere. Just look for DelimitedText Jan 31 at 20:01

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.