• Post Reply Bookmark Topic Watch Topic
  • New Topic

Integer escape sequence  RSS feed

 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need to send integers through the NetBeans command line window. This window is interpreting my characters as unicode, so to get around this, I am doing:


So that if I enter "2012" in the command line, it will be interpreted as an integer, rather than as a unicode sequence.

I am looking for a more convenient way of doing this...is there an escape character I can use that allows one to input plain integers?

Thanks.
 
Sheriff
Posts: 22846
43
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. What you get from a command line (Netbeans's or anybody else's) is just text.
 
Mikpo Siru
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see.

The reason I am looking into this is because I am emulating a simple FTP server. When an FTP client connects to my machine, I respond with an integer return code. The only way I have been able to send the integer return codes is by using the parseInt() method.

Any suggestions on improving my current approach?

Thanks.
 
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mikpo Siru wrote:I see.

The reason I am looking into this is because I am emulating a simple FTP server. When an FTP client connects to my machine, I respond with an integer return code. The only way I have been able to send the integer return codes is by using the parseInt() method.

Any suggestions on improving my current approach?

Thanks.


There's no need to improve it. If you have a String, which, as already pointed out, is always the case when you read input from a console, and you want an int, then the correct way is to use Integer.parseInt(). Why do you think you need to improve on it?
 
Mikpo Siru
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I thought there may be a more convenient way to inline unicode text and integers. I'll just modify the code to seek out integers from the input string.

Thanks.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!