Rohit Bajaj
asked on
Parsing a string in java
Hi,
I have a string of the form <user>id</user>text<user>i d2</user>t ext1<user> id3</user>
I want to convert this String to <user>name</user>text<user >name2</us er>text1<u ser>name3< /user>
Basically each userId has a corresponding name which i need to fetch from DB and replace this id with the name.
How do i do it effeciently in java.
Thanks
I have a string of the form <user>id</user>text<user>i
I want to convert this String to <user>name</user>text<user
Basically each userId has a corresponding name which i need to fetch from DB and replace this id with the name.
How do i do it effeciently in java.
Thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
There is one reason why templating probably could not apply here... correct me if i am wrong...
<user>id</user>text<user>i d2</user>t ext1<user> id3</user>
In the above string i need to extract the id and then search for a corresponding name in DB and replace it there
So i need to fetch the id , id2 etc. values which will require parsing it..
<user>id</user>text<user>i
In the above string i need to extract the id and then search for a corresponding name in DB and replace it there
So i need to fetch the id , id2 etc. values which will require parsing it..
Oh sorry - i thought it was the other way around ;)
The same could go for
https://www.experts-exchange.com/questions/29071171/Mentions-on-a-page-how-to-handle.html