This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Find carriage return in string value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Find carriage return in string value" Watch "Find carriage return in string value" New topic
Author

Find carriage return in string value

Melinda Savoy
Ranch Hand

Joined: Jun 21, 2005
Posts: 386

I have textarea box in my web page and in my javacode I am needing to break up this string if the length of the string is more than 45 character or if a carriage return is found in the string.

My question is how do I find a carriage return in a string value?

Any suggestions or direction would be greatly appreciated.

Regards.
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
A carriage return is represented as a \r.
Srikanth Ramu
Ranch Hand

Joined: Feb 20, 2007
Posts: 76
For more details refer below link:

http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html
Melinda Savoy
Ranch Hand

Joined: Jun 21, 2005
Posts: 386

Thanks for the help guys.

Regards.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Also note that a carriage return ('\r') is different than a newline ('\n') or form feed ('\f').


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Find carriage return in string value
 
Similar Threads
remove carriage return from string
Parsing XML data using SAXParser.
carriage return
BASE64Encoder
Unicode Characters