aspose file tools*
The moose likes Beginning Java and the fly likes how to take a series of string from command line? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "how to take a series of string from command line?" Watch "how to take a series of string from command line?" New topic
Author

how to take a series of string from command line?

yuvraj kotegar
Ranch Hand

Joined: Jul 31, 2008
Posts: 120
Hi i know to take a series of string from command line??


i know to take it with args[0],args[1] but how to take it has a whole??

i mean if i enter "I AM LEARNING JAVA" in the command line

i want to count the number of times "I" repeats in the sentence
so i can't take args[0],args[1]... so how do i take this full sentence as a single thing in my program?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41815
    
  62
By enclosing it in double quotes, like this:

Then it'll all end up in args[0] - without the quotes.


Ping & DNS - my free Android networking tools app
yuvraj kotegar
Ranch Hand

Joined: Jul 31, 2008
Posts: 120
Thanks for the reply


any other options??
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19693
    
  20

Join your parameters into one string:


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41815
    
  62
any other options?

What else are you looking for that this very simple way of doing things doesn't accomplish?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38765
    
  23
Originally posted by yuvraj kotegar:
i can't take args[0],args[1]...


Yes, you can; Rob has already told you how to iterate through the array with a for loop.
yuvraj kotegar
Ranch Hand

Joined: Jul 31, 2008
Posts: 120
Great help guys.. thanks

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to take a series of string from command line?