How to seperate <Enter> from a String in mySQL DB

I've a form who's data i'm submitting into mySQL Database. i've wnat to display the data from the DB to teh screen but if user had pressed <Enter> after a sequence of characters , which is represented as "\r\n" in db , I've to represent it the similar way on to the Screen .Like:-

This

is

just

Test

has to represented as it is & not as"This is just Test".

How to do it .Plz help.

[451 byte] By [preeti_k] at [2007-9-19]
# 1
I am not sure what u r writing .But I think u want to have string like :" I /n"+"am /n"+"not /n"+" clear /n";if not this, do write ur problem,bye,Samir
samirkolarkar at 2007-7-5 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 2

Samir,

my requirement is ..if user has pressed <Enter> somewhere in filling a form, i need to break the line at that character & display the rest of the String on next line.

I doono how to do that. Like :-

This

is

testing

sud appear like this only ..& not like "This is testing", which is stored in DB as "This\r\nis\r\ntesting"

My problem is to break teh line at every occurance of "\r\n"

Help appreciated .

preeti_k at 2007-7-5 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 3

oh!

That means u have : "this /n is/n test/n" test in ur database and to display it is a problem

ok?

If I am right then u can use substring to get the string from 0 to for first occurance of /n and

then first occurance of /n to second occurance of /n and so on.

if u can do this ,ok. or write me I will give u code, but try urself first,

ok? bye,

Samir

samirkolarkar at 2007-7-5 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 4

I'm able to get the Identify the <enter> in my String thru code:-

int lAbstract = abstrac.length(); //lenght of abstrac field

out.println("Length of abstract is : "+lAbstract);

boolean rtrue=true;

boolean rfalse=false;

for (int intIndex=0;intIndex<lAbstract;intIndex++)

{

boolean t = abstrac.startsWith("\r\n",intIndex);

if (t==rtrue)

{

out.println("Enter at : "+intIndex);

}

}

But now i'm getting confused how to print the string with correct formatting....>

preeti_k at 2007-7-5 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 5
String str = "This\r\nis\r\ntesting";StringTokenizer st = new StringTokenizer(str."\r\n");while(st.hasMoreTokens()) {System.out.println(st.nextToken());}This is want you want I believe. Don't forget to import java.util.StringTokenizer;Sudha
sudha_mp at 2007-7-5 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 6
Sorry for the typo. It is,StringTokenizer st = new StringTokenizer(str,"\r\n");Sudha
sudha_mp at 2007-7-5 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 7
Thanx for ur help, btw i already corrected that typose error.
preeti_k at 2007-7-5 > top of java,Enterprise & Remote Computing,Web Tier APIs...