Results 1 to 9 of 9
Thread: String, quotes and args
- 02-04-2010, 02:39 AM #1
String, quotes and args
Say i pass a
parameter to your Java application, what's the args[0]?Java Code:blah
blah
Now lets say i pass youparameter to you. Now what's the args[0]?Java Code:"blah"
blah again
How about this? I would like to not have my Strings translated ... In a second case, i actually want to have args[0] to beLiterally. No translation. I want my quotes back. How can do that?Java Code:"blah"
Thanks guys
-
I think that it's more an OS issue than a Java issue (though I could be wrong). Any thoughts from any others?
-
Ah, how about if you use \"blah\" as your command-line parameter?
- 02-04-2010, 03:22 AM #4
Well, that's cheating - user input cannot be controlled
-
- 02-04-2010, 09:26 AM #6
Moderator
- Join Date
- Apr 2009
- Posts
- 10,448
- Rep Power
- 16
Also, I really wouldn't expect a non-tech savvy person running a Java program from the command line...:)
- 02-04-2010, 01:55 PM #7
Doesn't have to be straight command line. Jsp with a fancy ui can provide a text box where user will type what he pleases including double quotes
Question remains unanswered - how to take command line arguments literally? If "a" is passed I want to deal with "a", not a
Thx
- 02-04-2010, 02:24 PM #8
Moderator
- Join Date
- Apr 2009
- Posts
- 10,448
- Rep Power
- 16
That's been answered.
The user has to escape the quotes.
Command line arguments are not JSP text boxes, or JTextFields (for Swing).
-
Similar Threads
-
Public static void main (String args[])
By arefeh in forum New To JavaReplies: 12Last Post: 01-28-2010, 11:58 AM -
What does String args[] stand for?
By Addez in forum New To JavaReplies: 7Last Post: 08-19-2009, 10:24 AM -
[SOLVED] [newbie] PrintStream printf(String fmt, Object... args)
By jon80 in forum New To JavaReplies: 6Last Post: 05-19-2009, 12:22 PM -
Why can't we write main without String args[]
By shailender in forum New To JavaReplies: 4Last Post: 11-05-2008, 10:58 AM -
[SOLVED] ReadLine(String fmt,Object... args) of Console class
By Pooja Deshpande in forum New To JavaReplies: 4Last Post: 04-25-2008, 05:51 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks