aspose file tools*
The moose likes Beginning Java and the fly likes charAt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "charAt" Watch "charAt" New topic
Author

charAt

Dorj Galaa
Ranch Hand

Joined: May 29, 2001
Posts: 113
original String is:
lfpdh,8256:8,64=8877,4;;6578;576;9444'87,U@Y%71(;876,HG\
if i wrote code and display every character of string
for (int i=0;i < str.length();i++)
{
a=str.charAt(i);
System.out.print(a);
}
RESULT is
lph85:,6=874;585694'7UY7(86H\
Why? How I get everycharacter of this String
(edited by Cindy to put space by < so it wouldn't be treated as html)
[This message has been edited by Cindy Glass (edited August 09, 2001).]


Senior software engineer
rajesh purohit
Ranch Hand

Joined: May 02, 2001
Posts: 33
what is ur for loop?
plz specify. you might be incrementing it by 2 characters, b'cos ur string is printing alternate characters
bye for now
Rajesh Purohit
INDIA
-------------------------------------------------------
visit me at www.geocities.com/rajesh_purohit/index.html

Bye for Now<P>Rajesh Purohit<BR>INDIA
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Works fine for me.
I used
<br /> Then keyed in the exact string that you gave:<br /> >java Test lfpdh,8256:8,64=8877,4;;6578;576;9444'87,U@Y%71(;876,HG\

I would guess that you are reading the string from a file, and the read mechanism isn't doing what you think that it is.


"JavaRanch, where the deer and the Certified play" - David O'Meara
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: charAt