Venkat Avasarala

Greenhorn
+ Follow
since Jul 05, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Venkat Avasarala

Hey Harpal,
Could you please tell me how you resolved the problem?
Thanks
Venkat
20 years ago
Joe,
Congrats! Could you please send me a copy of your study guide?
My E-mail: javavenki@hotmail.com
Thank you.
Venkat Avasarala
20 years ago
Jay,
Here is the deal!
I guess the second result you are getting from the database is not of the form:
st[1] = "first "second" third" - (lets say this type 1)
but of the form:
st[1] = "first " second " third" - (type 2)
So, when the code is executed java sees the space right before the word second and assumes that, thats the end of the string that it needs to read.
If you could somehow manipulate the incoming data as shown in type 1 instead of as in type 2, it should work as you expected it to be.
I know this is not exactly the solution you are looking for, but this is what I could think of right on top of my head. Let me sleep on this and see if I could come up with a better solution.
Venkat

Originally posted by jay Rotti:
Hello,
This value I am getting from database.
while(resultset.next())
{
string[i]=resultset.getString("full_name");
i++;
}
after that in jsp I am displaying the same. Till this stage i don't have any problem.
After this stage I need to replace every occurance of " with + and so on. This where I have problem.
Either I need find index of " or i should replace " with + without "\". Because this is happening dynamically I need to find a way to do this replace dynamically.
any help ?
Thanks


20 years ago
Hi Jay,
I am not sure how you get this code to compile. The compiler should stop you at the assignment statement:
st[1]= "Joseph "Tony" Leahy";
But the trick is to negate the special meaning of the double quotes surronding Tony.
So, change the statement to:
st[1] = "Joseph \"Tony\" Leahy";
This should work.
Venkat

Originally posted by jay Rotti:
Hi,
Looks simple but need answer. May be it needs some trick which is not getting to this dumb mind.
I have string[] st =new String[2];
st[0]= "Derek Leahy";
st[1]= "Joseph "Tony" Leahy";
st[0].replace(' ','+') gives me Derek+Leahy
where as
st[1].replace(' ','+') give only Joseph+
I need this answer to be Joseph+"Tony"+Leahy;

Can some one help me to treak this trick.
thanks


20 years ago