Created
September 12, 2022 11:56
-
-
Save japharr/8aca32ed3a1a972f345b04713be53d1c to your computer and use it in GitHub Desktop.
Text file parser
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.demo.controller; | |
import java.util.ArrayList; | |
import java.util.List; | |
public class Record { | |
private String desId; | |
private String sourceId; | |
public static void main(String[] args) { | |
List<String> contents = new ArrayList<>(); | |
List<Record> records = new ArrayList<>(); | |
for(int i=0; i<contents.size(); i++) { | |
if(i<5) continue; | |
int j = i; | |
String line = contents.get(i); | |
if(line.trim().startsWith("Destination Identifier")) { | |
String desId = line.substring(27, 68).trim(); | |
String desCurCode = line.substring(93).trim(); | |
String line2 = contents.get(i+1); | |
String line3 =contents.get(i+2); | |
Record record = new Record(desId, decu); | |
records.add(record); | |
i += 8; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment