Article View: borland.public.jbuilder.java.language
Article #14519Re: How to compare characters in Strings
From: Patrick Luginb�hl
Date: Sat, 28 Aug 1999 00:00
Date: Sat, 28 Aug 1999 00:00
14 lines
1094 bytes
1094 bytes
Code like this:
if (c == '\n')
fin = true;
is not cross-platform. On Unix the line terminator is "\n", on Windows, it
is frequently "\r\n", on the Mac it is "\r".
The call System.getProperty("line.separator") will return a string
containing the platform-specific line separator character(s), and you then
need to compare it according to how your data is formatted (e.g. compare 2
characters or one).
Good luck
Patrick
Technical Details
Message-ID:
<K0Qx3.13$D31.16780@news>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7q1dkr$7sa$1@nnrp1.deja.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,b2df74743a5cf7a0 X-Google-Attributes: gidf74b3,public From: "Patrick Luginb�hl" <patrick.luginbuehl@switzerland.org> Subject: Re: How to compare characters in Strings Date: 1999/08/28 Message-ID: <K0Qx3.13$D31.16780@news> X-Deja-AN: 518163222 References: <7q1dkr$7sa$1@nnrp1.deja.com> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3155.0 X-Trace: news 935840938 193.72.68.232 (Sat, 28 Aug 1999 13:48:58 MET DST) Organization: EUnet AG, Switzerland. A KPNQwest Company. NNTP-Posting-Date: Sat, 28 Aug 1999 13:48:58 MET DST Newsgroups: borland.public.jbuilder.java.language