Hi, I would like to find out if my String "str" contains carriage return. Would you take a look please what I am doing wrong .
if ( charInString("\000d", str) ) out.print( "I have found a Carriage return" );
public boolean charInString(String c, String s) { for (int i = 0; i < s.length(); i++) { if (String.valueOf(s.charAt(i)) == c) return true; } return false; }
but the problem with this was that I still needed to know what platform I was running on. Since unix, windows, mac all use different control charactors. I finally got my code to work but it is hardcoded for unix.
Please ignore post, I have no idea what I am talking about.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Manuel Paco
Ranch Hand
Joined: Sep 23, 2001
Posts: 58
posted
0
Thank you very much, but my code still does not work. (I run Windows 2000) I am using String that I got from JTextArea and I still can't find any carriage return in my string even it is there. I've tried everything you advised. Do you have any more ideas?
Manuel Paco
Ranch Hand
Joined: Sep 23, 2001
Posts: 58
posted
0
I forgot to mention that the carriage return was made by out.println("");