This commit is contained in:
2026-09-22 17:57:34 +02:00
commit 3909a40d8f
7 changed files with 92 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk-27">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
+17
View File
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Ficheros_01</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
+13
View File
@@ -0,0 +1,13 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=26
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=26
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=26
BIN
View File
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,50 @@
package org.palomafp.aadd.rif;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
public class AppPrincipal {
public static void main(String[] args) {
String ruta = "C:\\Users\\alumnoT\\aadd\\fic01.txt";
File archivo = new File(ruta);
if (!archivo.exists()) {
System.out.println("Error: El archivo no existe en la ruta especificada.");
return;
}
try (BufferedReader br = new BufferedReader(new FileReader(archivo))) {
String linea;
while ((linea = br.readLine()) != null) {
if (linea.trim().isEmpty()) continue;
// 1. Reemplazamos todas las comillas dobles por comillas simples
String lineaModificada = linea.replace("\"", "'");
// 2. Separamos los campos por la coma (o el delimitador que uses)
String[] datos = lineaModificada.split(",");
if (datos.length == 4) {
// Limpiamos espacios en blanco externos alrededor de los datos
String codigo = datos[0].trim();
String nombre = datos[1].trim();
String horas = datos[2].trim(); // El número ya no tendrá comillas dobles
String familia = datos[3].trim();
// 3. Imprimimos el INSERT. Los valores de texto ya traen sus comillas del replace.
// El valor numérico de las horas se imprime tal cual.
System.out.printf("INSERT INTO T_PAIS VALUES (%s, %s, %s, %s);%n",
codigo, nombre, horas, familia);
} else {
continue;
}
}
} catch (IOException e) {
System.err.println("Ocurrió un error al leer el archivo: " + e.getMessage());
}
}
}