difference between strings?

  • Thread starter nooneinparticular314159
  • Start date
N

nooneinparticular314159

I'm trying to pass an IP address in the form of a string into a method.
If I pass in a string that I read in that contains:

128.120.101.12

I get null.

If I pass in:

"128.120.101.12"

or InputString, where InputString = "128.120.101.12"

I get a valid return value.

Any idea what is wrong?

Thanks!
 
O

Oliver Wong

I'm trying to pass an IP address in the form of a string into a method.
If I pass in a string that I read in that contains:

128.120.101.12

I get null.

If I pass in:

"128.120.101.12"

or InputString, where InputString = "128.120.101.12"

I get a valid return value.

Any idea what is wrong?

I can't imagine how you managed to "pass in a string" without using the
quotation marks. Try posting an SSCCE. http://mindprod.com/jgloss/sscce.html

- Oliver
 
C

Chris Smith

I'm trying to pass an IP address in the form of a string into a method.
If I pass in a string that I read in that contains:

128.120.101.12

I get null.

If I pass in:

"128.120.101.12"

or InputString, where InputString = "128.120.101.12"

I get a valid return value.

I don't know what you mean by InputString. There is no type called
InputString in the standard Java library. As for the rest, though, I
would check whether the string you're passing in contains any whitespace
or such that might affect the parsing. Try passing the result of
calling trim() on the String, instead of calling directly.

--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top