BestTechie Forums: Java Scanner Object - BestTechie Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Java Scanner Object


#1 User is offline   Matt 

  • root
  • Group: Contributor
  • Posts: 3512
  • Joined: 23-August 04
  • Location:Ohio
  • Operating System:Ubuntu 9.04 (64 bit), Vista Home Premium (32 bit)

Posted 29 September 2008 - 12:19 PM

I'm looking for a way to use a scanner object to take a String from input, and not divide tokens with spaces. So when the user enters a string, it will take the whole thing, regardless of spaces. I'd like to accomplish this without the use of regex.
name1 = input.next();


Edit: let me just add, that it will need to use whitespace as a delimiter also. For example, entering 55 66 new york i'd like to grab 55, 66, and new york
Thanks,
Matt

#2 User is offline   Matt 

  • root
  • Group: Contributor
  • Posts: 3512
  • Joined: 23-August 04
  • Location:Ohio
  • Operating System:Ubuntu 9.04 (64 bit), Vista Home Premium (32 bit)

Posted 29 September 2008 - 04:10 PM

never mind, got it:
input.nextLine();


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users