how to replace "(double quotes) in a string with \" in java | How do I retrieve query parameters in a Spring Boot controller? | Storing a new object as the value of a hashmap?
Tutorial
by Er Satya
All > Tech Blogger | Java | Spring Boot | HTML | CSS | MySQL > Java | Spring Boot
1 like
Please login to like this article.
Example -
str = str.replace("\"", "\\\"")
Avoid using replaceAll
since it uses regex syntax in description of what to replace and how to replace, which means that \
will have to be escaped in string "\\"
but also in regex \\
(needs to be written as "\\\\"
string) which means that we would need to use.
str = str.replaceAll("\"", "\\\\\"");
str = str.replaceAll("\"", Matcher.quoteReplacement("\\\""))
How do I retrieve query parameters in a Spring Boot controller?
Use @RequestParam
@RequestMapping(value="user", method = RequestMethod.GET)
public @ResponseBody Item getItem(@RequestParam("data") String empId){
Emp i = empDao.findOne(empId);
String EmpName = i.getEmpName();
String dept= i.getDept();
return i;
}
Storing a new object as the value of a hashmap?
HashMap mapper = new HashMap();
mapper.put("Satya", new Emp("Satya"));
...
Emp value = mapper.get("Satya");
Integer memory = value.getMemory();
More articles from same author:
More articles:
Recent lost & found:
Login for enhanced experience
Create and manage your profile
Refer an author and get bonus Learn more
Publish any lost and found belongings
Connect with the authors & add your review comments
Join us for Free to advertise for your business or
Contact-us for more details
Join us for Free to publish your own blogs, articles or tutorials and get your
Benefits
Discover your area of interest
Advertisement
Art & entertainment
Astrology & spirituality
Cooking
Culture
Current affairs
Education
Fashion
History
Hotel management
Industry
Medical & fitness
Motivational
Politics
Real life stories
Sports
Story & poetry
Technology
Top in search
Tourism
More recent categories
Education(Public)
By: SLA
software (Public)
By: raydensmith
software(Public)
By: raydensmith
Why You Should Invest in African Gold: A Comprehensive Guide for Global Investors(Public)
By: BONASGOLD
The Best Gold Exporters in Africa: A Guide for Global Investors(Public)
By: BONASGOLD
Why You Should Consider Buying Wholesale Gold from Africa(Public)
By: BONASGOLD
Why Buy 24K Gold from Africa: A Smart Investment Choice(Public)
By: BONASGOLD
Trusted Gold Dealers in Africa ? How to Buy Gold Safely from Reliable Suppliers(Public)
By: BONASGOLD
Gold Dore Bars Africa ? How to Buy Authentic African Gold Dore Bars(Public)
By: BONASGOLD
Gold Suppliers in Africa ? Your Ultimate Guide to Buying Authentic Gold(Public)
By: BONASGOLD