Created
June 18, 2015 12:03
-
-
Save JuanjoSalvador/8bed02945406fa42b0bd to your computer and use it in GitHub Desktop.
This file contains 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
public class main { | |
public static void cambiaLetras() { | |
try { | |
FileReader fr = new FileReader("texto.txt"); | |
BufferedReader br = new BufferedReader(fr); | |
String str = null; | |
while ((str = br.readLine()) != null) { | |
for (int i = 0; i < str.length(); i++) { | |
int charac = str.charAt(i); | |
if (charac != 32 && charac < 132) { | |
int characMayus = charac + 32; | |
System.out.print((char) characMayus); | |
} | |
if (charac != 32 && charac > 132) { | |
int characMinus = charac - 32; | |
System.out.print((char) characMinus); | |
} | |
if (charac == 32) { | |
System.out.print((char) 32); | |
} | |
if (charac == 10) { | |
System.out.println("\n"); | |
} | |
} | |
} | |
} catch (IOException ex) { | |
System.out.println("No se encontró el archivo"); | |
} | |
} | |
public static void main(String[] args) { | |
cambiaLetras(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment