identifying a carriage return in string

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Aug 2007
Posts: 8
Reputation: vivek_green is an unknown quantity at this point 
Solved Threads: 0
vivek_green vivek_green is offline Offline
Newbie Poster

identifying a carriage return in string

 
0
  #1
Oct 24th, 2007
Hi,
Can someone tell me how to identify a carriage return character in string
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 4,508
Reputation: Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future 
Solved Threads: 522
Moderator
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Industrious Poster

Re: identifying a carriage return in string

 
0
  #2
Oct 24th, 2007
Just like you would identify any other character in a string: look for "\r\n" or "\n" (system dependent).
Reply With Quote Quick reply to this message  
Join Date: Mar 2004
Posts: 801
Reputation: Phaelax is on a distinguished road 
Solved Threads: 39
Phaelax Phaelax is online now Online
Practically a Posting Shark

Re: identifying a carriage return in string

 
0
  #3
Oct 24th, 2007
I believe there's a static variable or system propery that holds the proper return character for the system the vm is running on. Sorry I can't remember exactly what it was.
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 4,508
Reputation: Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future 
Solved Threads: 522
Moderator
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Industrious Poster

Re: identifying a carriage return in string

 
0
  #4
Oct 24th, 2007
Yes, System.getProperty("line.separator") can be used for the system you are running on, but if you are reading files from external sources the linefeeds may differ from your own.
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 7,649
Reputation: ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of 
Solved Threads: 474
Super Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Failure as a human

Re: identifying a carriage return in string

 
0
  #5
Oct 25th, 2007
You people are getting confused between newline and carriage returns. A carriage return is just a carriage return and is always '\r'.

It's the 'newline' character which is different on different systems. (\r, \n, \r\n)
I don't accept change; I don't deserve to live.

Jo Tujhe Jagaaye, Nindein Teri Udaaye Khwaab Hai Sachcha Wahi.
Nindon Mein Jo Aaye Jise To Bhul Jaaye Khawab Woh Sachcha Nahi.
Khwaab Ko Raag De, Nind Ko Aag De
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 4,508
Reputation: Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future 
Solved Threads: 522
Moderator
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Industrious Poster

Re: identifying a carriage return in string

 
0
  #6
Oct 25th, 2007
Originally Posted by ~s.o.s~ View Post
You people are getting confused between newline and carriage returns. A carriage return is just a carriage return and is always '\r'.

It's the 'newline' character which is different on different systems. (\r, \n, \r\n)
Yes, agreed. I just figured he was asking in a more general sense about line breaking characters.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC