GeeCON Prague 2014*
The moose likes Beginning Java and the fly likes problem with finding index of a string? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "problem with finding index of a string?" Watch "problem with finding index of a string?" New topic
Author

problem with finding index of a string?

J radolf
Ranch Hand

Joined: Jan 08, 2009
Posts: 121


Hi my requirement is i should find the index of string whcih is entered in the command line and it should count from the list i put in collection.

i know to see the index from the command line but how to count with respect to the values entered in list?
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10426
    
    8

"January Radolf"
Please check your private messages for an important administrative matter.

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
santhosh.R gowda
Ranch Hand

Joined: Apr 06, 2009
Posts: 296
[MG]Edited content. Please do not provide ready made answers. Ref David's post below


Creativity is nothing but Breaking Rules
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

NotACodeMill

Don't just blindly supply answers: the point is to help people learn, and learn how to learn, not do their work for them. If the OP was in a class, for example, you just did their homework for them.

(Btw, I knew someone named January once. And Carrot. One never knows...)
santhosh.R gowda
Ranch Hand

Joined: Apr 06, 2009
Posts: 296
Please do not provide ready made answers.



Sorry for binding the answer.But i had not given any ready made answers please don't think that people will give ready made answers .
anandhi mohan
Greenhorn

Joined: Mar 24, 2009
Posts: 9
use this to get the list index for your given input.

int c= l.indexOf(a);
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

anandhi mohan wrote:use this to get the list index for your given input.

int c= l.indexOf(a);

List has an indexOf() method?
anandhi mohan
Greenhorn

Joined: Mar 24, 2009
Posts: 9
David Newton wrote:
anandhi mohan wrote:use this to get the list index for your given input.

int c= l.indexOf(a);

List has an indexOf() method?


yes, list has this method.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Whoops, I was looking at Collection--never mind.

Still shouldn't blindly provide answers, though: provide resources, assist the poster's thought process, etc. Handing them solutions on a plate serves no one.
J radolf
Ranch Hand

Joined: Jan 08, 2009
Posts: 121
hey thanks guys for your answers.But i had got the answer myself.

should tell you one thing. Working in a IDE helps you a lot.

because all the available methods are listed
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18876
    
  40

Okay... the side discussion topic (about giving out answers) has been split from this topic...

http://www.coderanch.com/t/450157/Ranch-Office/with-finding-index-string


This topic can now return to talking about the original subject.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
GeeCON Prague 2014
 
subject: problem with finding index of a string?