I’m trying to extract values from a text file. The content of the file is as follows:
Cliente
1, 'Aarón', 'Rivero', 'Gómez', 'Almería', 100
2, 'Adela', 'Salas', 'Díaz', 'Granada', 200
3, 'Adolfo', 'Rubio', 'Flores', 'Sevilla', NULL
4, 'Adrián', 'Suárez', NULL, 'Jaén', 300
5, 'Marcos', 'Loyola', 'Méndez', 'Almería', 200
6, 'María', 'Santana', 'Moreno', 'Cádiz', 100
7, 'Pilar', 'Ruiz', NULL, 'Sevilla', 300
8, 'Pepe', 'Ruiz', 'Santana', 'Huelva', 200
9, 'Guillermo', 'López', 'Gómez', 'Granada', 225
10, 'Daniel', 'Santana', 'Loyola', 'Sevilla', 125
I’ve managed to read the file and get the lines, but I can’t specify the exact lines that start with digits. I want to split the values and add them to an SQL table. Using line.startsWith("^[0-9].*")
doesn’t seem to work, and I’m out of ideas. I tried using a matcher
to match the line, and it doesn’t work either.
2
Answers
this code worked for me