Java method for replacing carriage return line feed in string
•
Java
Replace with regular expression:
Code snippet:
String documentTxt = EntityUtils. toString(entity,"gbk");// Get data documentxt = documentxt replaceAll("[\\t\\n\\r]","");// Remove carriage returns and linefeeds from the content area
Note: replaceall of string class has regular replacement function. \T is tab character \ n is line feed \ R is carriage return
Java regular usage:
Example method:
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码