Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Find carriage return in string value

 
Melinda Savoy
Ranch Hand
Posts: 387
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A carriage return is represented as a \r.
 
Srikanth Ramu
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 387
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the help guys.

Regards.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also note that a carriage return ('\r') is different than a newline ('\n') or form feed ('\f').
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic