Hello!
I have been using xParam to parse input arguments to my programs with no problems, but I ran into the following issue while parsing a given string:
The NoViableAlt exception is thrown when the string argument contains the character "+"
e.g.
myProgram theString="onlyAlphaNumeric"
goes well, but
myProgram theString="onlyAlphaNumeric+someMore"
fails.
Wondering what's the problem. I thought that the parser would copy the chars from argv if it realizes that is not a number.
Thanks a lot!
Eduardo
the shell strips your quotes, so what XParam gets as input is onlyAlphaNumeric+someMore
which is not a valid string in XParam. You need to give XParam this: "onlyAlphaNumeric+someMore"
one common way to do this is give this input at the shell: myProgram 'theString="onlyAlphaNumeric+someMore"' (added single quotes around all input)
Log in to post a comment.
Hello!
I have been using xParam to parse input arguments to my programs with no problems, but I ran into the following issue while parsing a given string:
The NoViableAlt exception is thrown when the string argument contains the character "+"
e.g.
myProgram theString="onlyAlphaNumeric"
goes well, but
myProgram theString="onlyAlphaNumeric+someMore"
fails.
Wondering what's the problem. I thought that the parser would copy the chars from argv if it realizes that is not a number.
Thanks a lot!
Eduardo
the shell strips your quotes, so what XParam gets as input is
onlyAlphaNumeric+someMore
which is not a valid string in XParam. You need to give XParam this:
"onlyAlphaNumeric+someMore"
one common way to do this is give this input at the shell:
myProgram 'theString="onlyAlphaNumeric+someMore"'
(added single quotes around all input)