• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

charAt

 
Dorj Galaa
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
rajesh purohit
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic