₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,161 members, 8,420,617 topics. Date: Friday, 05 June 2026 at 07:13 AM

Toggle theme

HenryBios's Posts

Nairaland ForumHenryBios's ProfileHenryBios's Posts

1 (of 1 pages)

WebmastersJava by HenryBios(op): 7:35am On Aug 17, 2010
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"wink;
}


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!!!!
ProgrammingRe: Java by HenryBios(op): 7:32am On Aug 17, 2010
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"wink;
}


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.
ProgrammingRe: Java by HenryBios(op): 5:15am On Aug 16, 2010
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"wink;
// 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!!!
ProgrammingJava by HenryBios(op): 8:29am On Aug 13, 2010
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)