small prob in ignoring strng wnat to skip 2nd value?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Vijendra_Singh
Posted On:   Friday, June 30, 2006 01:57 AM

FileReader inputstream = new FileReader("C:/Documents and Settings/vijendras/Desktop/sampleApplicationchngd.sql"); BufferedReader rdr = new BufferedReader( inputstream ); // the StringBuilder which stores the processed lines StringBuffer dataLines = new StringBuffer(); // read the file line by line String dataLine; while( ( dataLine = rdr.readLine() ) != null ) { // split the input data into words upto first 3 words only String[] tokens = dataLine.split( " ", 3 ); // if the line starts with 'create' and a 'view' follows it, // then add a "--" to the beginning   More>>




FileReader inputstream = new FileReader("C:/Documents and Settings/vijendras/Desktop/sampleApplicationchngd.sql");

BufferedReader rdr = new BufferedReader( inputstream );



// the StringBuilder which stores the processed lines

StringBuffer dataLines = new StringBuffer();



// read the file line by line

String dataLine;

while( ( dataLine = rdr.readLine() ) != null ) {

// split the input data into words upto first 3 words only

String[] tokens = dataLine.split( " ", 3 );



// if the line starts with 'create' and a 'view' follows it,

// then add a "--" to the beginning of the line

if( tokens[ 0 ].equalsIgnoreCase( "CONSTRAINT" ) &&

tokens[ 2 ].equalsIgnoreCase( "NOT" ) &&

tokens[ 3 ].equalsIgnoreCase( "NULL" ) )

dataLines.append( " NOT " ).append(" NULL ").append(" , ").append(" -- ");



dataLines.append( dataLine ).append( '
' );

System.out.println( "Executed");

}

rdr.close(); // close the file



// open the file for writing new data to it

BufferedWriter writer = new BufferedWriter(new FileWriter("C:/Documents and
Settings/vijendras/Desktop/sampleApplicationchngd.sql"));



// write the new StringBuilder's data back to the file.

writer.write( dataLines.toString(), 0, dataLines.length() );

writer.close();





   <<Less

Re: small prob in ignoring strng wnat to skip 2nd value?

Posted By:   WarnerJan_Veldhuis  
Posted On:   Friday, June 30, 2006 03:12 AM

Are we now supposed to copy/paste this, setup an environment, compile and run this, and see whatever fails??? Please post only code that is related, and ask a more specific question.
About | Sitemap | Contact