• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

asking about substring searching method

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have a question regarding string given below:
String x="my name is good fellow";
String y=x.substring(3,10);
my question is :
the string method starts searching substring from 3 from string saves in x n it does not end at 10 but at 9.y it ends at 9 if it starts searching from 3 .i hope that u have underestand my question n i hope that you will reply me soon.
take care
thank you very much in advance
with regards
kumar abhay
 
Sheriff
Posts: 17644
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Kumar,
Your questions will be more readable and will have a better chance of getting answered if you spell out words like "and", "why" and "you". Thank you for doing so in the future
I, too, find the way substr() works a little goofy as it differs from other substr() functions I have used in the past in other languages. It's just one of those idiosyncracies that you have to remember, I guess.

------------------
Junilu Lacar
Sun Certified Programmer for the Java� 2 Platform
[This message has been edited by JUNILU LACAR (edited October 20, 2001).]
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It starts with the letter which is after index 3 and ends with the letter before index 10, remembering that the count starts from zero.

The character at index 9 is the last letter, because the sub-string encompasses the characters BETWEEN the indexes given.
[This message has been edited by Cindy Glass (edited October 23, 2001).]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic