🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #14573

How to compare characters in Strings

#14573
From: lblaszczyk
Date: Wed, 25 Aug 1999 00:00
20 lines
1158 bytes
  I am attempting to compare characters within a String() variable
against the new line character. This is a sample of what I have:

String  Text = "this\nthat";

for (int i=0; i<Text.Length(); i++)
{
 if ( Text.charAt(i) == '\n' )
  System.out.println("Debug: Matches");
}

  The problem is.. that the if statement comes up true on EVERY
character. Any help welcome on how to make this work.

-- Thanks



Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Technical Details
Message-ID: <7q1dkr$7sa$1@nnrp1.deja.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,b2df74743a5cf7a0,start
X-Google-Attributes: gidf74b3,public
From: lblaszczyk@hotmail.com
Subject: How to compare characters in Strings
Date: 1999/08/25
Message-ID: <7q1dkr$7sa$1@nnrp1.deja.com>
X-Deja-AN: 517104970
X-Http-Proxy: 1.1 x41.deja.com:80 (Squid/1.1.22) for client 144.174.137.126
Organization: Deja.com - Share what you know. Learn what you don't.
X-Article-Creation-Date: Wed Aug 25 18:45:50 1999 GMT
X-MyDeja-Info: XMYDJUIDblaszczykl
Newsgroups: borland.public.jbuilder.java.language
X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)