• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

charAt

 
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).]
 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sunglasses. AKA Coolness prosthetic. This tiny ad doesn't need shades:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic