hi
i want to check a char in the char array
public void characters(char[] chars, int start, int length)
{
if (chars!='/n' || chars((char)'/r'))
{
System.out.println("String read is " +
new String(chars, start, length));
}
}
thanks
JC 4 8152
"JC" <JC@JC.com> wrote in message news:40**********@rain.i-cable.com... hi
i want to check a char in the char array
public void characters(char[] chars, int start, int length) { if (chars!='/n' || chars((char)'/r')) { System.out.println("String read is " + new String(chars, start, length)); } }
I hope you know that this line:
if (chars!='/n' || chars((char)'/r'))
should be something like [assuming you want to eliminate both newline and
carriage return]:
if (chars[i] != '\n' && chars[i] != '\r')
The expanded code, though I'm not certain what it is you are wanting to
accomplish:
for (int i = 0; i < chars.length; ++i)
{
...
if (chars[i] != '\n' && chars[i] != '\r')
{
...
}
}
I hope this helps.
Anthony Borla
"JC" <JC@JC.com> wrote in message news:40**********@rain.i-cable.com... hi
i want to check a char in the char array
public void characters(char[] chars, int start, int length) { if (chars!='/n' || chars((char)'/r')) { System.out.println("String read is " + new String(chars, start, length)); } }
I hope you know that this line:
if (chars!='/n' || chars((char)'/r'))
should be something like [assuming you want to eliminate both newline and
carriage return]:
if (chars[i] != '\n' && chars[i] != '\r')
The expanded code, though I'm not certain what it is you are wanting to
accomplish:
for (int i = 0; i < chars.length; ++i)
{
...
if (chars[i] != '\n' && chars[i] != '\r')
{
...
}
}
I hope this helps.
Anthony Borla
i use a for loop before. but no use for my coding. i need to read a XML file
and save all these data to a java array. i want to skip the return and new
line char. Can anyone give me some idea?
Thanks
JC
"Anthony Borla" <aj*****@bigpond.com> wrote in message
news:wc*****************@news-server.bigpond.net.au... "JC" <JC@JC.com> wrote in message news:40**********@rain.i-cable.com... hi
i want to check a char in the char array
public void characters(char[] chars, int start, int length) { if (chars!='/n' || chars((char)'/r')) { System.out.println("String read is " + new String(chars, start, length)); } }
I hope you know that this line:
if (chars!='/n' || chars((char)'/r'))
should be something like [assuming you want to eliminate both newline and carriage return]:
if (chars[i] != '\n' && chars[i] != '\r')
The expanded code, though I'm not certain what it is you are wanting to accomplish:
for (int i = 0; i < chars.length; ++i) { ... if (chars[i] != '\n' && chars[i] != '\r') { ... } }
I hope this helps.
Anthony Borla
i use a for loop before. but no use for my coding. i need to read a XML file
and save all these data to a java array. i want to skip the return and new
line char. Can anyone give me some idea?
Thanks
JC
"Anthony Borla" <aj*****@bigpond.com> wrote in message
news:wc*****************@news-server.bigpond.net.au... "JC" <JC@JC.com> wrote in message news:40**********@rain.i-cable.com... hi
i want to check a char in the char array
public void characters(char[] chars, int start, int length) { if (chars!='/n' || chars((char)'/r')) { System.out.println("String read is " + new String(chars, start, length)); } }
I hope you know that this line:
if (chars!='/n' || chars((char)'/r'))
should be something like [assuming you want to eliminate both newline and carriage return]:
if (chars[i] != '\n' && chars[i] != '\r')
The expanded code, though I'm not certain what it is you are wanting to accomplish:
for (int i = 0; i < chars.length; ++i) { ... if (chars[i] != '\n' && chars[i] != '\r') { ... } }
I hope this helps.
Anthony Borla This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Danny Anderson |
last post by:
Hola!
I have an array of shorts that represents a stream of data. This data is
packed in tight, so certain elements may actually contain data for more
than one variable.
I am to decipher this...
|
by: Psykarrd |
last post by:
I am trying to declare a string variable as an array of char's. the
code looks like this.
char name;
then when i try to use the variable it dosn't work, however i am not
sure you can use it...
|
by: arkobose |
last post by:
my earlier post titled:
"How to input strings of any lengths into arrays of type: char
*array ?"
seems to have created a confusion. therefore i paraphrase my problem
below.
consider the...
|
by: Timothy Shih |
last post by:
Hi, I am trying to figure out how to use unmanaged code using P/Invoke. I
wrote a simple function which takes in 2 buffers (one a byte buffer, one a
char buffer) and copies the contents of the byte...
|
by: gcary |
last post by:
I am having trouble figuring out how to declare a pointer to an array
of structures and initializing the pointer with a value. I've looked
at older posts in this group, and tried a solution that...
|
by: ayman723 |
last post by:
hi,
I'm trying to write a program in wich I would generate 20 sentences out of
4 arrays(articles,nouns,preposition,verb).I have to select an item at random
from each array and concatetane each one...
|
by: Gilles Vollant \(MVP\) |
last post by:
Hello
I've (in WinImage SDK http://www.winimage.com/wima_sdk.htm ) a function that
I need to use from a VB.Net apps
First, on the unmanaged Win32 DLL, I've a function which get the number of...
|
by: untitled |
last post by:
i wrote an application in c++ that capture a motion from a bmp
sequence and outputs a 3DS max secript file contains the motions keys.
i have two points here need to be fixed:
1- it is an offline...
|
by: Paul David Buchan |
last post by:
Hello,
I'm attempting to write a program to read in database files (.dbf).
When I do it all as a single procedure in main, everything works.
However, what I really want, is to pass the database...
|
by: Nezhate |
last post by:
Hi There,
I'm writing a program that takes a decimal number and returns it's
binary equivalent.
the problem is that I don't know how to return (from function) the
binary value as an array of...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |