HenryBios's Posts
Nairaland Forum › HenryBios's Profile › HenryBios's Posts
1 (of 1 pages)
import java.io.*; class FileRead { public static void main(String args[]) { try{ var iChars = "*|,\":<>[]{}`\';()@&$#%"; for (var i = 0; i < string.length; i++) { if (iChars.indexOf(string.charAt(i)) != -1){ System.out.println("Characters found" ;} catch (Exception e){ System.err.println("Error: " + e.getMessage()); } } } } Please let me know what is wrong with the above code. It is giving some compilation errors. I am trying to set an alert once I read the text file which contains special characters. Help!!!! |
import java.io.*; class FileRead { public static void main(String args[]) { try{ var iChars = "*|,\":<>[]{}`\';()@&$#%"; for (var i = 0; i < string.length; i++) { if (iChars.indexOf(string.charAt(i)) != -1){ System.out.println("Characters found" ;} catch (Exception e){ System.err.println("Error: " + e.getMessage()); } } } } Please let me know what is wrong with the above code. It is giving some compilation errors. |
I am using this code to read the txt file. import java.io.*; class FileRead { public static void main(String args[]) { try{ // Open the file that is the first // command line parameter FileInputStream fstream = new FileInputStream("textfile.txt" ;// Get the object of DataInputStream DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String strLine; //Read File Line By Line while ((strLine = br.readLine()) != null) { // Print the content on the console System.out.println (strLine); } //Close the input stream in.close(); }catch (Exception e){//Catch exception if any System.err.println("Error: " + e.getMessage()); } } } Which code I have to add to get the alert message that your file contains special characters. Please help!!! |
I want to develop an application in java which searches special characters in a .CSV, Flat File and Excel sheet. I want an alert once it finds any special characters in these files.Please provide the complete code. |
1 (of 1 pages)
;