Programming tutorials online .NET, Java, C++, Visual Basic, and More
 

Home
.NET Tutorials
General Programming Tutorials
Community/Forums
Site Extras

 

Java/J2EE Forum
 

Open forum for discussing anything Java related. J2EE, JSPs, servlets, EJBs, JDBC, its all fair game and can be found in the Java/J2EE forum!


<< Back to Java/J2EE Forum VIEW REPLIES | POST REPLY
Posted By: jnox   5/6/2006 7:15:00 AM
Reply To: vandana who posted...
 
I can give you a simple example, here goes:
----------
String b = "Hello\nMotto\n!";
StringReader sr = new StringReader(b);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int ch = 0;

for (int i=1;i<=b.length() ;i++ ){
ch = sr.read();
if (ch!=10){ //value 10 is enter
//when you catch the character of enter, do what u have to do. In here, I put character into ByteArrayOutputStream.
baos.write(ch);
}
}

System.out.println(baos.toString());
----------
Have a nice try!

REPLY PREVIEW POSTED BY WHEN
What jnox means to say is, there is a character that wil... robosycho 5/8/2006 5:42:00 PM


 
Sign In
Email
Password
  Forgot my password

Search

Featured Book

Introducing Microsoft .Net, Third Edition ($19.79)
Introducing Microsoft .Net, Third Edition


Featured Software

Microsoft Visual Studio Standard 2005 ($249.99)
Microsoft Visual Studio Standard 2005