• Post Reply Bookmark Topic Watch Topic
  • New Topic

String method....  RSS feed

 
Shiaber Shaam
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public int indexOf(int ch, int fromIndex)
*if the fromIndex is greater than the length of the string wats the
effect....
*if the fromIndex is equal to the length of the string wats the
effect....
*if the fromIndex is negative wats the effect....
 
wise owen
Ranch Hand
Posts: 2023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no restriction on the value of fromIndex. If it is negative, it has the same effect as if it were zero: this entire string may be searched. If it is greater than the length of this string, it has the same effect as if it were equal to the length of this string: -1 is returned.
 
Balaji Sampath
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hope this sample code will help your understanding!!!




And the output is as follows:

Index equals String Length: -1
Index greater than String Length: -1
Index is negative: 5


Thanks
Balaji.S
 
Shiaber Shaam
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can u explain it more....
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!